301 joomla .htaccess重定向

时间:2013-09-11 14:57:48

标签: html .htaccess joomla2.5

我们将Joomla 1.5更新为2.5并且更改了许多链接,因此我们在htaccess中进行301重定向;但是我遇到了一堆无法正常工作的人。

redirect 301 /photos-a-movies/photos-of-old-friends/119-halloween/detail/946-604a927.html?tmpl=component http://www.handicappedpets.com/photos-a-movies/media-photos.html
redirect 301 /photos-a-movies/photos-of-old-friends/101-friends/detail/671-dcp0062.html?tmpl=component http://www.handicappedpets.com/photos-a-movies/media-photos.html
redirect 301 /photos-a-movies/photos-of-old-friends/101-friends/detail/1286-barks.html?tmpl=component http://www.handicappedpets.com/photos-a-movies/media-photos.html

也许它会在网址末尾追上垃圾?无论哪种方式......有没有办法让301重定向说“/ photos-a-movies /老朋友的照片”,无论是什么,它被重定向到一个页面?或者有没有理由说这些301不起作用?

编辑:

如果我这样做,我可以让它发挥作用:

redirect 301 /photos-a-movies/photos-of-old-friends/101-friends/detail/1286-barks.html http://www.handicappedpets.com/photos-a-movies/media-photos.html

而不是

redirect 301 /photos-a-movies/photos-of-old-friends/101-friends/detail/1286-barks.html?tmpl=component http://www.handicappedpets.com/photos-a-movies/media-photos.html

重定向到http://www.handicappedpets.com/photos-a-movies/media-photos.html?tmpl=component 但它仍然将“?tmpl = component”放在最后。有没有办法摆脱它?

1 个答案:

答案 0 :(得分:0)

原始重定向无效的原因是您无法在?tmpl=component指令中与查询字符串(URI的Redirect部分)匹配。

  

但它仍然将“?tmpl = component”放在最后。有没有办法摆脱它?

您需要在目标网址的末尾添加?

http://www.handicappedpets.com/photos-a-movies/media-photos.html?

问题是在重定向之后,你最后有一个迷路?。如果你不能拥有它,那么你需要使用mod_rewrite:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^tmpl=component$
RewriteRule ^/photos-a-movies/photos-of-old-friends/101-friends/detail/1286-barks.html$ http://www.handicappedpets.com/photos-a-movies/media-photos.html? [L,R=301]