Nginx伪静态规则
###当存在多个子目录格式的域名时,需要多写几组location标签:location /目录/
location / {
if (-f $request_filename) {
break;
}
if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") {
break;
}
if (!-e $request_filename) {
rewrite . /index.php last;
}
}
Nginx规则(目录模式手机站)
###当存在多个子目录格式的域名时,需要多写几组location标签:location /目录/
location /mobile/ {
if (-f $request_filename) {
break;
}
if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") {
break;
}
if (!-e $request_filename) {
rewrite . /mobile/index.php last;
}
}
location / {
if (-f $request_filename) {
break;
}
if ($request_filename ~* "\.(js|ico|gif|jpe?g|bmp|png|css)$") {
break;
}
if (!-e $request_filename) {
rewrite . /index.php last;
}
}
Apache伪静态规则
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# 404页面
ErrorDocument 404 /404.html
# 不带www跳转到www
RewriteCond %{HTTP:Host} ^123.com$
RewriteRule (.*) http://www.123.com/$1 [NC,R=301]
# xunruicms
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /index.php [NC,L]
</IfModule>
Apache规则(目录模式手机站)
<IfModule mod_rewrite.c>
RewriteEngine On
# 字体图标跨域
<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
# 二级目录手机站伪静态放在m文件夹下
RewriteBase /m/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !.(js|ico|gif|jpe?g|bmp|png|css)$ /m/index.php [NC,L]
</IfModule>
IIS伪静态规则
<rewrite>
<rules>
<rule name="xunruicms IIS 伪静态" stopProcessing="true">
<match url=".(js|ico|gif|jpe?g|bmp|png|css)$" negate="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/index.php" />
</rule>
</rules>
</rewrite>
IIS规则(目录模式手机站)
<rewrite>
<rules>
<rule name="xunruicms mobile" stopProcessing="true">
<match url="^mobile/(.*)$" ignoreCase="false"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/>
</conditions>
<action type="Rewrite" url="/mobile/index.php"/>
</rule>
<rule name="xunruicms PC" stopProcessing="true">
<match url=".(js|ico|gif|jpe?g|bmp|png|css)$" negate="true"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/>
</conditions>
<action type="Rewrite" url="/index.php"/>
</rule>
</rules>
</rewrite>
声明:禁止复制、盗用、采集、发布本站内容到任何网站及各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
