--thinkphp8的访问路径
默认PATHINFO模式:
//单应用模式
http://serverName/index.php/控制器/操作/参数/值…
//多应用模式
http://serverName/index.php/应用/控制器/操作/参数/值...
不支持PATHINFO的服务器可以使用兼容模式访问:
http://serverName/index.php?s=/控制器/操作/[参数名/参数值...]
--URL重写隐藏入口文件(默认index.php)
Apache
1、Apache服务器conf文件夹下的httpd.conf配置文件中加载了mod_rewrite.so模块(默认加载)
2、public目录下的.htaccess文件重写配置:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
</IfModule>
3、如果上述没效果,将httpd.conf下的所有的 AllowOverride 的None改为All
4、重启Apache服务器(如果只是更改了.htaccess则不需要重启)
nginx
1、public目录下的nginx.htaccess文件加上如下配置转发规则:
location / {
if (!-f $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}