YzmCMS伪静态配置

袁志蒙 40696次浏览

摘要:新手朋友推荐使用宝塔面板【一键部署】,查看教程:https://blog.yzmcms.com/php/231.html, YzmCMS伪静态配置(YzmCMS5.0及以上版本):Apache伪静态(即YzmCMS自带的.htaccess文件):<IfModul...

新手朋友推荐使用宝塔面板【一键部署】,查看教程:https://blog.yzmcms.com/php/231.html

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>

伪静态文件下载:

YzmCMS伪静态配置下载

随机内容

表情

共10条评论
  • 网友评论:

    网友 : 为什么我设置了还是不行 管理员:可以加入YZMCMS官方QQ交流群进行求助: 161208398

    2022-11-29 19:11:06 回复

    点击加载
  • 网友评论:

    为什么我设置了还是不行

    2021-11-25 18:12:10 回复

    点击加载
  • 网友评论:

    网友 : 百度的香港虚拟主机 nginx就不行首页可以 访问不了后台 404 Not Found 管理员:百度云伪静态文件叫做:bcloud_nginx_user.conf , 把上面的Nginx规则复制到 bcloud_nginx_user.conf ,然后放到网站根目录下就可以了

    2021-07-10 23:38:32 回复

    点击加载
  • 网友评论:

    百度的香港虚拟主机 nginx就不行首页可以 访问不了后台 404 Not Found

    2021-07-09 00:06:45 回复

    点击加载
  • 网友评论:

    请问一下这个你这个代码高亮有没有教程加个代码复制工具栏

    2021-01-31 13:20:55 回复

    点击加载
  • 网友评论:

    求OpenLiteSpeed 规则

    2020-05-19 23:04:31 回复

    点击加载
  • 网友评论:

    管理员 回复 YzmCMS博客网友 :phpstudy2018 不支持PHP7.0以上伪静态,建议升级phpstudy8.0后在试

    2019-08-29 21:01:18 回复

    点击加载
  • 网友评论:

    我下载了5.3版本,只能用首页和文章,不能使用后台登录页面。

    我的配置是:windows7 本地环境,phpstudy2018 , php7.1.13 nts + nginx

    修改了:
    hosts
    vhosts.conf


    location / {
    #//...省略部分代码
    if (!-e $request_filename){
    rewrite ^(.*)$ /index.php?s=$1 last; break;
    }
    }

    2019-08-29 16:39:42 回复

    点击加载
  • 网友评论:

    管理员 回复 YzmCMS博客网友 :建议检查一下服务器环境后重试

    2018-10-22 17:55:47 回复

    点击加载
  • 网友评论:

    5.1用htacess正常。换了iis环境,用文末文件下载中的web.config好像不正常,页面可以访问,但是验证码不能显示。不知道是不是web.config文件要更新了?

    2018-10-22 15:07:43 回复

    点击加载