My project is setup in CodeIgniter. To cleanup CI's url I added a RewriteRule to the htaccess of the page which removes the ugly 'index.php':
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
This rule rewrites:
https://baseurl/index.php
to
https://baseurl/
Now, I also want to use javascript deeplinking, because the project relies heavily on Ajax page refreshes. The deeplink looks like this:
https://baseurl/#/deeplink
Problem is: The rewrite rule deletes my beatifully injected deeplink and redirects the user to the root site... How can i get rid of the index.php without deleting my deeplink on a hard page refresh?
Thanks!
Dave Timmerman
The fragment #/deeplink is never sent to the server, URL fragments are kept around only on the client's end (the browser). It's never sent to the server as part of the request. The request:
https://baseurl/#/deeplink
Looks no different to the index.php script than:
https://baseurl/
Not sure how you were ever able to read the fragment on the server to begin with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With