Apache
httpd.conf
配置文件中加载了mod_rewrite.so
模块AllowOverride None
将None
改为 All
.htaccess
文件放到应用入口文件的同级目录下
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
或者
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
Nginx
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
#autoindex on;
}
发布时间 : 2023-03-01,阅读量:4607
, 分类:
PHP
ThinkPHP
Nginx
Apache