我有一些已发布或共享的URI,现在我需要redirect。 旧url的forms是:
http://www.mysite.com/!#story/45 ,我想将它们redirect到http://www.mysite.com/#!story/name-of-the-story
我已经尝试了.htaccess文件(Apache 2.2)
redirect 301 /#!story/45 /#!story/name-of-the-story
要么
RewriteCond %{REQUEST_URI} ^(.*)#!story/45(.*)$ RewriteRule ^(.*)$ /#!story/name-of-the-story [R=301]
但是这不会redirect的URL(它只是没有效果)。 !#语法由我们使用的库生成,称为prettyPhoto,它从javascript写入位置哈希值:
location.hash = decodeURI('!' + theRel + '/'+story_slug+'/');
任何人都可以解释为什么这不起作用,或提出一个方法呢? 我有mod_rewrite启用。
不可能。 锚不是URI或查询string的一部分,所以它们根本不会被发送到Apache。