lazylester Posted May 26, 2008 Share Posted May 26, 2008 I'm using mod_rewrite to manipulate requests that look like this: www.mydomain.com/myfile.html#someanchor I would like the anchor name ("someanchor") to appear as a $_GET parameter, so rewrite the filename to myfile.html?anchor=someanchor However the mod_rewrite regex pattern seems to fail with the #. I've tried my regex expressions on other regex engines (e.g. php) and it finds the pattern, but in mod_rewrite, the # seems to terminate the pattern search. For example, if I request the file myfile.htmlmyanch#or to this: RewriteRule ^(.*).html([a-z#]*) test.html\?position=$2 the variable in $2 is "myanch" (even if I escape the # in the regex pattern, which I don't believe is necessary, but tried anyway) Can anyone shed any light on this, please? thanks in advance Les Link to comment https://forums.phpfreaks.com/topic/107342-solved-mod_rewrite-with-in-regex-pattern/ Share on other sites More sharing options...
lazylester Posted May 27, 2008 Author Share Posted May 27, 2008 I've learned that the "fragment identifier" appended to a URI with the "#" prefix, is not sent to the server by the browser. Instead it is retained by the browser and used to navigate to a reference within the returned document when the server responds. That's why I couldn't match it with the mod_rewrite regex. Link to comment https://forums.phpfreaks.com/topic/107342-solved-mod_rewrite-with-in-regex-pattern/#findComment-550764 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.