2014-07-25 161 views
0

我试图重定向多个URL ...htaccess的子域名重定向文件夹路径,新的URL

http://download.stevechab.com/album/allergy TO http://histamines.bandcamp.com/album/allergy

http://download.stevechab.com/album/reallergy-remix-album TO http://histamines.bandcamp.com/album/reallergy-remix-album

http://download.stevechab.com/album/vanillarabb TO http://arabbi.bandcamp.com/album/vanillarabb

http://download.stevechab.com/album/arabb TO 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

只能匹配使用%{http_host}可变主机/域名。

您可以在根的.htaccess使用这样的规则:

RewriteEngine on 

RewriteCond %{HTTP_HOST} ^download\.stevechab\.com$ [NC] 
RewriteRule ^(album/.+)$ http://histamines.bandcamp.com/$1 [R=301,NC,L] 
+0

嗯,我还有其他的专辑,我重定向,以及...像http://download.stevechab.com/album/vanillarabb到http://arabbi.bandcamp.com/album/vanillarabb。 –

+1

好的检查更新的答案,但你应该在你的问题中说清楚。 – anubhava

+0

完成。对不起'回合。那么,我可以添加文件夹路径吗? 下载\ .stevechab \ .com/album/allergy $ –

相关问题