2014-10-30 54 views
0

在新服務器上創建開發站點後,htaccess文件錯誤地重定向鏈接。例如,如果點擊來自example.com的鏈接example.com/test,它將嘗試重定向到example.com/example.com/test。我怎樣才能糾正下面的htaccess文件:.htaccess文件重定向不正確

<IfModule mod_rewrite.c> 
    # Turn on the Rewrite Engine 
    RewriteEngine On 

    RewriteBase/

    # If the file or directory exists, show it 
    RewriteCond %{REQUEST_FILENAME} -f [OR] 
    RewriteCond %{REQUEST_FILENAME} -d 
    RewriteRule ^(.+) - [PT,L] 

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

    # Blank queries get sent to the index 
    RewriteRule ^$ /index.php [L] 

    # All other queries get sent to the index as index.php/whatever 
    RewriteRule ^(.*)$ /index.php?$1 [L] 
</IfModule> 

<ifModule mod_headers.c> 
Header set Connection keep-alive 
</ifModule> 
+0

,當你鍵入'http://www.example.com/會發生什麼測試'在瀏覽器中? – anubhava 2014-10-30 16:53:17

+0

可能你在HTML – Deadooshka 2014-10-30 16:57:15

+0

@anubhava中有'href =「example.com/test」',它工作的很好。 – user2694306 2014-10-30 17:05:25

回答

0

插入此規則僅低於RewriteBase重定向到/example.com/test/test

RewriteRule ^example\.com/(.+)$ /$1 [L,NC,NE,R=302]