不少小伙伴首次安装使用YzmCMS后,登录后台admin,报404找不到该页面,这是因为你的环境没有正确配置伪静态,你可根据你的服务器环境自行配置伪静态规则,这里推荐大家使用Linux+Nginx环境,正确配置后即可正常使用。
新手朋友推荐使用宝塔面板【一键部署】,查看教程:https://www.yzmcms.com/dongtai/126.html
Apache伪静态(即系统自带的.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>
系统授权查询