我的网址是这样的:http://31.220.56.75/mysystem/public/index.php/login如何删除url中的index.php? (laravel 5.3,PHP 7)
我想删除的index.php,是这样的:http://31.220.56.75/mysystem/public/login
我的.htaccess:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule^index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
我尝试一些教程谷歌。但我没有找到解决办法
更新:
我尝试更新的.htaccess这样的:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
它不工作
确保启用了mod_rewrite。 'a2enmod rewrite',然后重新加载apache服务。 –
@Laurent Meganck,我曾经运行它。但是,它不工作 –
Laravel的默认HTACCESS文件应该已经工作。您有任何机会错误地设置您的虚拟主机? – Ronald