我想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]
请告知
答案 0 :(得分: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在对RewriteRule
中的正则表达式进行匹配之前会被解码,因此,除非您的网址已经编码+
个符号,否则它们会被解码为空格而不是
答案 1 :(得分: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]