我的網址是這樣的: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