1

I have urls which I need to redirect to another URL. The issue is that the source URLs contain # character.

source url: http://www.wawa.com/fr/#/creations/eclairs
redirect to : http://www.wawa.fr/fr/patisseries-1

source url: http://www.wawa.com/fr/#/home
Redirect to : http://www.wawa.fr/fr/

I have tried to use redirect 301 but it doesn't seem to work: (just for urls with #). See my code below-

Redirect 301 /fr/#/creations/eclairs http://www.wawa.fr/fr/patisseries-1
  • The # character isn't part of the URL seen by the server; it indicates a tag inside the current page. eg http://foo/bar#baz means request http://foo/bar and then jump to tag baz . The best you can redirect on the server is the whole http://wawa.com/fr/ page. Otherwise you'll need to write a html page that does client side redirection via javascript. – Stephen Harris Aug 3 '16 at 12:03
  • I can't redirect the whole page. as there are several # that need redirecting to other pages. I read somewhere that i can use RewriteRule. But I don't know what regex to use to interprete # – scandalous Aug 3 '16 at 12:07
  • As Stephen Harris says, you cannot do this on the server. Apache httpd never sees a '#' in the URL, because the browsers interpret that part. They never send it to Apache (unless it is encoded). So it doesn't matter what regex you use. – Unbeliever Oct 1 '16 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.