2016-11-17 66 views
1

我正在開發一個Symfony 2.8/Sonata項目,並且我發現所有的url都是重複的,一個帶有「/index.php」,另一個帶着它。 所以這個網址:sonata從網址中刪除/index.php

http://mydomaine.com/index.php/test/test.html

將被重定向到:

http://mydomaine.com/test/test.html

我試圖用的.htaccess刪除它,但它沒」 t工作:

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /index.php?/$1 [L] 
    RewriteRule ^(.*)$ app_dev.php [QSA,L] 
</IfModule> 

你有什麼想法嗎? 感謝

+0

那不是我的工作:),我只是試圖掩蓋的index.php –

回答

1

將這一規則略低於RewriteEngine On從網址中刪除index.php

RewriteCond %{THE_REQUEST} /index\.php [NC] 
RewriteRule ^index\.php(/.+)$ $1 [L,R=301,NE] 
+0

謝謝,但,一切都沒有改變! –

+0

你在瀏覽器中輸入了什麼網址? – anubhava

+0

http://mydomaine.com/index.php/test/test.html,沒有重定向 –