Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use a hashmark in .htaccess URL?

I'm using jquery address and everything is working great except for one small issue inside my .htaccess file. I'd like to redirect one of my urls that includes a hashmark to another URL.

Here is my current setup using redirect (that works):

Options +FollowSymLinks
RewriteEngine on
RewriteRule view_profile=(.*)$ view_profile.php?id=$1 

If a user logs in at any point this URL doesn't work because my jquery address looks like this:

http://localhost/#view_profile=5

If I add the leading hash as part of my rewriterule it breaks. Does anyone know if it's possible to use a leading hashmark as part of the URL?

like image 796
Paul Avatar asked Feb 23 '23 22:02

Paul


1 Answers

No you can't do this, as anything after the # is a fragment identifier and therefore not sent to the server.

See the RFC on URIs here: https://www.rfc-editor.org/rfc/rfc3986#section-3.5

like image 84
Malcolm Box Avatar answered Feb 25 '23 10:02

Malcolm Box