0
嗨在我們的網站上,我們遇到了一個問題,比如我們在沒有WWW的情況下輸入url等。 example.com/xyz
在這種情況下,後重定向它轉換成www.example.com/?url=xyz
但應重定向到只是想:www.example.com/xyz
問題雖然從非WWW URL重定向到WWW URL
所以我們得到額外?url= in URL
我們使用的代碼爲重定向非WWW網址到www我們htaccess文件。在htaccess文件代碼重定向:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
我們也試過這個代碼,但不工作:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
</IfModule>
謝謝@JOnLin的答覆,但它不解決我的問題仍然是問題是相同的嗎?url = URL中即將到來 – Ankit 2014-10-06 16:31:29
@Ankit你清除了瀏覽器的緩存嗎? – 2014-10-06 16:31:54
我已經檢查了刪除所有緩存後,即使在兩個瀏覽器中檢查。這個問題只在我嘗試打開除example.com之外的其他主頁時纔會出現,如果我只爲example.com嘗試,它會重定向到www.example.com – Ankit 2014-10-06 16:43:07