您现在的位置是:首页 > 程序 > php网站首页php

YzmCMS伪静态配置

  • 袁志蒙
  • 2018-06-03 00:00:16
  • 35027 次阅读
YzmCMS伪静态配置(YzmCMS5.0版本的伪静态规则与之前版本不同,所以本教程只适用于5.0及以上版本):Apache伪静态(即YzmCMS自带的.htaccess文件):

YzmCMS伪静态配置(YzmCMS5.0版本的伪静态规则与之前版本不同,所以本教程只适用于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/conf/vhost.conf ):

location / {
	index  index.html index.htm index.php;
	#autoindex  on;
	if (!-e $request_filename) {
		rewrite ^(.*)$ /index.php?s=$1 last; break;
	}			
}

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>

文件下载: YzmCMS伪静态配置下载

TAG: YzmCMS

文章评论 (0)

    • 这篇文章还没有收到评论,赶紧来抢沙发吧~


Top