Reputation: 3276
I have a .htaccess file with those contents:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ([^/\.]+)$ index.php?string=$1&match=all [L]
So when I type: domain.com/test the page redirects to domain.com/index.php?string=test&match=all
But if I want to reach this page: domain.com/test#sub1
the page redirects to domain.com/index.php?string=test&match=all
instead of domain.com/index.php?string=test#sub1&match=all
How do I proceed?
Upvotes: 0
Views: 114
Reputation: 801
Anchors/hashes are only used by the browser. The server won't see requests for those, because such a request would be invalid. (There is no "test#sub1" file, only a "test" file.) It has no way of knowing you're just wanting to access an anchor and not trying to access a file that doesn't exist, so such information is not passed to the web server.
EDIT: Also, redirecting everything through a single php file just seems like malpractice to me. Maybe there's something special going on here that makes it a reputable approach though.
Upvotes: 1