[英]htaccess redirect subdomain folder path to new URL
我正在嘗試重定向許多URL ...
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
謝謝!
史蒂夫
您只能使用%{http_host}
變量來匹配主機名/域名。
您可以在根.htaccess中使用此規則:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^download\.stevechab\.com$ [NC]
RewriteRule ^(album/.+)$ http://histamines.bandcamp.com/$1 [R=301,NC,L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.