我试图重定向一些网址......
http://download.stevechab.com/album/allergy致http://histamines.bandcamp.com/album/allergy
http://download.stevechab.com/album/reallergy-remix-album致http://histamines.bandcamp.com/album/reallergy-remix-album
http://download.stevechab.com/album/vanillarabb致http://arabbi.bandcamp.com/album/vanillarabb
http://download.stevechab.com/album/arabb致http://arabbi.bandcamp.com/album/arabb
我试过这个:
RewriteEngine on
rewritecond %{http_host} ^download\.stevechab\.com/album/allergy [nc]
rewriterule ^(.*)$ http://histamines.bandcamp.com/album/allergy$1 [r=301,nc]
Redirect 301 http://download.stevechab.com/album/allergy http://histamines.bandcamp.com/album/allergy
它没有用。我可以访问stevechab.com htaccess文件,但不能访问download.stevechab.com htaccess文件。有没有办法做这个重定向?
这是我整个htaccess文件的样子......
ErrorDocument 404 http://www.stevechab.com
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^stevechab.com [nc]
rewriterule ^(.*)$ http://www.stevechab.com/$1 [r=301,nc]
Redirect 301 http://stevechab.com http://www.stevechab.com
rewritecond %{http_host} ^download\.stevechab\.com/album/allergy [nc]
rewriterule ^(.*)$ http://histamines.bandcamp.com/album/allergy$1 [r=301,nc]
Redirect 301 http://download.stevechab.com/album/allergy http://histamines.bandcamp.com/album/allergy
谢谢!
史蒂夫
答案 0 :(得分:0)
您只能使用%{http_host}
变量匹配主机/域名。
您可以在根.htaccess中使用此规则:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^download\.stevechab\.com$ [NC]
RewriteRule ^(album/.+)$ http://histamines.bandcamp.com/$1 [R=301,NC,L]