2016-08-18 59 views
1

我是laravel中的新人我只是嘗試刪除每個路線中的index.php,例如https://localhost/test/public/index.php/test1https://localhost/test/public/test1。 我可以使用mod_rewrite代碼來解決這個問題,但不起作用。 我的.htaccess文件的代碼可以是公共文件夾內的情況如下: -如何在laravel 5.2中創建漂亮的url?

Options -MultiViews 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L] 

它顯示錯誤

​​3210
+0

[htaccess的可能的重複刪除索引.php from url](http://stackoverflow.com/questions/4365129/htaccess-remove-index-php-from-url) – Lag

回答

0

試試這個

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .* index.php 
+0

感謝您的回答Mishanon,但它也無法正常工作。 –

+0

你是否安裝mod_rewrite? – mishanon

+0

是的,我可以啓用mod_rewite。 我的操作系統是Ubuntu 16.04。 –