2016-08-18 60 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。 –