zoukankan      html  css  js  c++  java
  • YzmCMS伪静态配置

    摘要:YzmCMS伪静态配置(YzmCMS5.0版本的伪静态规则与之前版本不同,所以本教程只适用于5.0及以上版本):Apache伪静态(即YzmCMS自带的.htaccess文件):<ifmodul...< p="">

    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>
  • 相关阅读:
    TCP IP基础知识的复习
    Design Pattern: Singleton 模式
    解决Win7下安装VS2010不显示序列号框的两种方法
    字典树(Trie tree)
    在VS如何查看汇编代码
    使用模板实现编译期间多态
    一段c++代码小例子
    C++ 虚函数表解析
    C++问题:if( input.rdstate() & std::ios::failbit )
    Design Pattern: Adapter 模式 Class Adapter
  • 原文地址:https://www.cnblogs.com/lsyw/p/14610900.html
Copyright © 2011-2022 走看看