伪静态(即URL重写)可以美化URL,使URL地址结构更清晰,更利于搜索引擎收录和青睐。
毕竟一长串且带着各种符号的网址,看着就让人头疼,对吧?
伪静态优势很多,为了让系统更好的扩展,MKapCMS显然是支持伪静态使用的。
开启伪静态方法也很简单,不管是Nginx、Apache还是IIS,都可以设置伪静态。
Nginx规则:
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
Apache规则:
< 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 >
IIS规则:(不建议)
在IIS的高版本下面可以配置web.Config,在中间添加rewrite节点:
< rewrite >
< rules>
< rule name="OrgPage" stopProcessing="true">
< match url="^(.*)$" />
< conditions logicalGrouping="MatchAll">
< add input="{HTTP_HOST}" pattern="^(.*)$" />
< add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
< add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
< /conditions>
< action type="Rewrite" url="index.php/{R:1}" />
< /rule>
< /rules>
< /rewrite >
而如果你服务器环境支持ISAPI_Rewrite的话,可以配置httpd.ini文件,添加这样的内容:RewriteRule (.*)$ /index\.php\?s=$1 [I]