1

I have some URIs which have been published or shared which I now need to redirect. The old urls take the form:

http://www.mysite.com/!#story/45 and I want to redirect them to http://www.mysite.com/#!story/name-of-the-story

I've tried the following in a .htaccess file (Apache 2.2)

redirect 301 /#!story/45 /#!story/name-of-the-story

OR

RewriteCond %{REQUEST_URI} ^(.*)#!story/45(.*)$
RewriteRule ^(.*)$ /#!story/name-of-the-story [R=301]

But this does not redirect the URL (it just has no effect). The !# syntax is generated by a library we are using called prettyPhoto which writes location hash from javascript :

location.hash = decodeURI('!' + theRel + '/'+story_slug+'/');

Can anyone explain why this wouldn't work or suggest a way round this? I have mod_rewrite enabled.

2

1 Answer 1

1

Not possible. Anchors aren't part of the URI or Query String, so they aren't sent to Apache at all.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .