2

我想301重定向以下网址

www.domain.com/Gallery2/v/South/Actress/Ritu+Kaur+Actress+Photos

www.domain.com/gallery/ritu-kaur.html

我尝试了以下,但没有奏效,

RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^Gallery2\/v\/South\/Actress\/Ritu\+Kaur\+Actress\+Photos\/$ "http\:\/\/www\.indiancinemagallery\.com\/gallery\/ritu\-kaur\.html" [R=301,L]

请指教

4

2 回答 2

0

将此规则放在您的Gallery2/.htaccess 任何其他重写规则之前

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^v/South/Actress/Ritu\+Kaur\+Actress\+Photos/?$ http://www.indiancinemagallery.com/gallery/ritu-kaur.html [R=301,L,NC]
于 2013-10-22T16:16:55.000 回答
0

这些+标志可能会被规范化为空格,请尝试用空格替换它们:

RewriteCond %{HTTP_HOST} ^domain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^Gallery2/v/South/Actress/Ritu\ Kaur\ Actress\ Photos/$ http://www.indiancinemagallery.com/gallery/ritu-kaur.html [L,R=301]

URI 在与 's 中的正则表达式匹配之前被解码RewriteRule,因此除非您的 url 具有编码+符号,否则它们将被解码为空格。

于 2013-10-22T13:42:43.873 回答