Nginx伪静态
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}小提示:部分比较旧的系统可能会出现不能访问后台的情况,建议使用如下配置
location / {
if (!-e $request_filename){
rewrite /admin.php(.*)$ /admin.php?s=$1 last;break;
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
#需要注意,这里的admin.php就是后台入口文件名,如果你更换了,请对应更改phpstudy 本地环境nginx配置提示:
尽量把前面的空格去掉,如下:
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}Apache伪静态
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
#RewriteCond %{REQUEST_URI} !((.*).jpg|.jpeg|.bmp|.gif|.png|.js|.css|.tts|.woff )$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
#RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
RewriteRule ^(.*)$ index.php [E=PATH_INFO:$1,QSA,PT,L]
</IfModule>IIS伪静态
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="allow_rules" enabled="true" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

闽公网安备 35058202000561号
中国互联网举报中心