2016-12-24 104 views

回答

0

您是否在您的Apache配置中設置了指令AllowOverride All? mod_rewrite模塊是否工作?

+0

請注意'AllowOverride All'只在apache 2.2及更舊的版本上 – rekire

0

試試這個,

RewriteEngine On 
# Take care of www.old.com.au 
RewriteCond %{HTTP_HOST} ^www.old.com.au$ [NC] 
RewriteRule ^(.*)$ http://www.new.com/$1 [L,R=301] 
RewriteCond %{QUERY_STRING} ^attachment_id=([0-9]*)$ [NC] 
RewriteRule ^$ http://www.new.com/? [R=301,NE,NC,L] 
0

這很簡單,我只是用這個做一些特別改寫爲我自己,這是你的代碼:

將這個你/www/.htaccess文件中:

RewriteEngine on 

// Rules to redirect to another domain 
RewriteCond %{HTTP_HOST} ^example.com [NC,OR] 
RewriteCond %{HTTP_HOST} ^www.example.com [NC] 
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC] 

檢查http://www.inmotionhosting.com/support/website/redirects/setting-up-a-301-permanent-redirect-via-htaccess,獲取3種其他方式進行重定向。

相關問題