第一步、开启apache 重写URL 模块
1、apache中httpd.cof文件
启用重写模块
#LoadModule rewrite_module modules/mod_rewrite.so
2、AllowOverride None 将 None 修改为 All
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
第二步、修改public/.htaccess文件
有好多人都是这么写的、连官网开发文档都是这样
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
下面是php study 集成环境 的修改方式
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule>
其实就是 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L] 改修改成
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]