我在这里有这样的重定向:
RewriteCond %{HTTP_HOST} ^gidranty.ispytanie01.ru
RewriteRule ^(.*)$ http://ispytanie01.ru/vodosnabzhenie/$1 [L,R=301]
但现在我需要一点复杂的重定向。如果用户打印" gidranty.ispytanie01.ru/spb"我需要将他重定向到" http://ispytanie01.ru/spb/vodosnabzhenie"。
我尝试使用这样的东西:
Redirect 301 http://gidranty.ispytanie01.ru/spb http://ispytanie01.ru/spb/vodosnabzhenie
但它不起作用。需要一些建议:)
答案 0 :(得分:1)
您可以使用:
RewriteCond %{HTTP_HOST} ^gidranty.ispytanie01.ru [NC]
RewriteRule ^spb(/.*)?$ http://ispytanie01.ru/spb/vodosnabzhenie$1 [NC,L,R=301]
RewriteCond %{HTTP_HOST} ^gidranty.ispytanie01.ru [NC]
RewriteRule ^(.*)$ http://ispytanie01.ru/vodosnabzhenie/$1 [L,R=301]