2014-07-25 246 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 $ –

相關問題