2012-06-29 57 views
0

我使用301從非WWW重定向到WWW域!工作正常,但鏈接不同。(.htaccess)301重定向到相同的url結構

例子:

from - ggkj.com/posts/godzilla/43 
to - www.ggkj.com/index.php?view=posts&author=godzilla&aid=43 

我的.htaccess 301重定向代碼:

RewriteEngine On 
RewriteBase/
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] 
RewriteRule ^(.*) http://www.example\.com/$1 [L,R=301] 

的.htaccess代碼:http://pastebin.com/t3FA59uq

回答

1

這是目前什麼我用在我的網站成功:

Options +FollowSymlinks 
RewriteEngine On 
RewriteCond %{http_host} !^www.walterbax.ca [NC] 
RewriteRule ^(.*)$ http://www.walterbax.ca/$1 [R=301,L] 

編輯:尋找到你的問題遠一點,我可以告訴你,你的問題是不正確放置在文件中之後。它必須符合將其重寫爲URL變量的另一個規則。

我會從www的基本htaccess開始。測試規則並從那裏添加。

0

試試這個:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^yourdomain.com$ 
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L] 
+0

不適合我! :/你100%確定? – aainaarz

+0

我在我的所有項目中都使用它,並且工作正常。 – Sangar82

+0

嗯,我不知道.htaccess - 我使用它,因爲我需要301! :D這是我的! http://pastebin.com/t3FA59uq – aainaarz