YzmCMS偽靜態配置(5.0及以上版本):
Apache偽靜態(即YzmCMS自帶的.htaccess文件):
<IfModule mod_rewrite.c> Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]</IfModule>Nginx偽靜態:
location / { #//...省略部分代碼
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}如果你的應用安裝在二級目錄,Nginx的偽靜態方法設置如下,其中youdomain是所在的目錄名稱。
location /youdomain/ {
if (!-e $request_filename){
rewrite ^/youdomain/(.*)$ /youdomain/index.php?s=$1 last;
}
}舉個栗子:
如果你用的是本機電腦上的phpstudy環境的話,在根目錄下新建偽靜態文件( nginx.htaccess ):
location / { if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}Nginx偽靜態配置后,需要重啟Nginx服務器才可生效,90%的情況下,Nginx的以上配置是完全沒問題的,如果你用的是老古董的話,那么你可以嘗試修改YzmCMS配置文件:
“common/config/config.php”,修改 配置項 “set_pathinfo” 為 true 來實現!
IIS偽靜態:
如果你的服務器環境支持ISAPI_Rewrite的話,可以配置httpd.ini文件,添加下面的內容:
RewriteRule (.*)$ /index\.php\?s=$1 [I]
在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?s={R:1}" /> </rule> </rules></rewrite>