开启这个的目的:为了在使用Laravel框架时输入URL省去index.pnp
未开启,必须加index.php:www.laravel.test/index.php/admin
开启后可直接访问:www.laravel.test/admin
尝试了多种方法如下:
直接开启Apache的rewrite_module 模块
尝试后无效!
在Apache的httpd.conf文件:
AllowOverride后None改为All
尝试后无效!
在.htaccesswen文件中(打开是空的)添加如下代码:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options +FollowSymLinks
</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>
成功解决!!!
原文:https://www.cnblogs.com/jingdr/p/14812893.html