0

Cannot seem to get a mod_rewrite to work. We have a domain name that has already been printed here, there and everywhere when the website was Flash. It has a # in its trail /#login.php and we want so that when people put this in it redirects them to /login.php. I have already tried this rule but can't get it to work:

RewriteEngine On
RewriteRule ^/#login.php$ /login.php

I have also checked that the rewrite engine is working by using a redirect to google. Just need the out of date #login.php to go to the new login.php

thanks

Ankur Loriya
  • 3,276
  • 8
  • 31
  • 58
trapper
  • 11,716
  • 7
  • 38
  • 82

2 Answers2

2

The # in the URL (or "fragment") is not sent to the server, it's purely for the client side to point to some part of the page. If you see http://hostname.com/#login.php in your address bar, the only thing the server gets is a request for /. You may need to employ some javascript on the page to look at the browser's address bar to find a fragment and maybe send that to the server as a query string.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • This sounds a bit beyond me. This site was inherited and unfortunately had this hash due to being Flash based. Not sure why. The company had already printed their publicity but our designer wants it to be /login.php. Thanks for your help. – trapper Jul 04 '12 at 09:58
  • My last comment was badly phrased. The full url that ends /#login.php used to go to a particular page for user registrations. On the new site that page is simply addressed /login.php and the former address defaults to the homepage which is not ideal. thanks again. – trapper Jul 04 '12 at 10:46
  • You'd need to add some javascript to the homepage that looks for the `#login.php` fragment and if it exists, redirect to `/login.php`. – Jon Lin Jul 04 '12 at 15:37
  • we were wondering if we could just add a named anchor into the top of the page so that #login.php would just jump to it? – trapper Jul 04 '12 at 16:07
  • The browser would jump to it, but that's it. I guess if you put a frame with /login.php inside at the #login.php anchor, but the page itself won't redirect there. – Jon Lin Jul 04 '12 at 16:11
0

Try :

RewriteEngine On
RewriteBase /
RewriteRule ^#login\.php$ /login.php [QSA,L] 

Mod_rewrite is enabled ? available ?

Clément Andraud
  • 9,103
  • 25
  • 80
  • 158
  • Mod_rewrite is enabled (i used a simple redirect to Google to test it). Your solution didn't work but thank you for your help. – trapper Jul 04 '12 at 09:59