代理加盟

2023全新代理计划,一站式模板建站,铜牌代理低至699元送终身VIP,独立代理后台,自营贴牌。

您现在的位置: 麦站网 > 云优教程 > 安装云优 >

云优CMS伪静态规则大全

来源:本站原创 发布时间:2022-11-14 20:34:48热度:我要评论(0

麦站模板建站平台(10年经验),服务数万家企业,固定透明报价。域名注册、主机/服务器、网站源码一站式服务。实体公司,专业团队,值得选择!超过1000套模板已登记版权,合规合法建站,规避版权风险!【点击获取方案】

很多小伙伴因为使用场景的问题,导致安装了云优CMS却无法使用伪静态模式,那么本篇文章结合具体使用场景为您介绍如何正确设置伪静态。根据使用场景我们可以分为服务器安装和空间安装云优CMS。

目录

  1. 宝塔面板伪静态
  2. IIS伪静态
  3. 阿里云增强型主机伪静态
  4. 百度云主机伪静态

1:宝塔面板

  • 1.1)apache环境

       云优系统默认自带apache环境的伪静态文件(.htaccess)。无需设置。apache环境对于新手用户是比较友好的,无需任何设置,只要站点根目录存在.htaccess伪静态文件就直接生效。

  • 1.2)nginx环境

       安装nginx环境的用户,需要左侧点击【网站】-【设置】-【伪静态】,将下面提供的nginx伪静态规则复制进去就可以了。

if (!-d $request_filename){
	set $rule_0 1$rule_0;
}
if (!-f $request_filename){
	set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
	rewrite ^/(.*).(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.htm;
}
  	rewrite ^/language/(.*).html$ /index.php?s=index/plugins&p=multilingual&c=index&a=index&lang=$1 last;
 	rewrite ^/index.html$ /index.html break;
	rewrite ^/admin/(.*).html$ /index.php?s=admin/$1 last;
	rewrite ^/admin/(.*)$ /index.php?s=admin/$1 last;
	rewrite ^/config/(.*)$ /404.htm last;
	rewrite ^/statics/ueditor/dialogs/(.*)/(.*).html$ /statics/ueditor/dialogs/$1/$2.html last;
	rewrite ^/m/$ /index.php?s=wap/index/index last;
	rewrite ^/m/search/$ /index.php?s=wap/search/index last;
	rewrite ^/m/myform/$ /index.php?s=wap/myform/index last;
	rewrite ^/m/captcha/(d*)$ /index.php?s=wap/myform/captcha&id=$1 last;
	rewrite ^/m/(.*)_search/$ /index.php?s=wap/search/index&area=$1 last;
	rewrite ^/m/(.*)_tag/([sS]*)$ /index.php?s=wap/tag/index&title=$2&area=$1 last;
	rewrite ^/m/tag/([sS]*)$ /index.php?s=wap/tag/index&title=$1 last;
	rewrite ^/m/(.*)/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 last;
	rewrite ^/m/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 last;
	rewrite ^/m/(.*)/(.*)_(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2 last;
	rewrite ^/m/(.*)_(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1 last;
	rewrite ^/m/(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$2&ctitle=$1&cw=$3 last;
	rewrite ^/m/(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$2&ctitle=$1 last;
	rewrite ^/m/(.*)/(.*)_(.*)/$ /index.php?s=wap/category/index&ctitle=$1/$3&area=$2 last;
	rewrite ^/m/(.*)_(.*)/$ /index.php?s=wap/category/index&ctitle=$2&area=$1 last;
	rewrite ^/m/(.*)/(.*)_(.*)/page/(d*)$ /index.php?s=wap/category/index&ctitle=$1/$3&area=$2&page=$4 last;
	rewrite ^/m/(.*)_(.*)/page/(d*)$ /index.php?s=wap/category/index&ctitle=$2&area=$1&page=$3 last;
	rewrite ^/m/(.*)/$ /index.php?s=wap/category/index&ctitle=$1 last;
	rewrite ^/m/(.*)/page/(d*)$ /index.php?s=wap/category/index&ctitle=$1&page=$2 last;
	rewrite ^/m/(.*).html$ /index.php?s=wap/index/index&area=$1 last;
	rewrite ^/index(.*)/$ /index.php?s=index/index/index/$1 last;
	rewrite ^/myform/$ /index.php?s=index/myform/index last;
	rewrite ^/(.*)_myform/$ /index.php?s=index/myform/index&area=$1 last;
	rewrite ^/captcha/(d*)$ /index.php?s=index/myform/captcha&id=$1 last;
	rewrite ^/(.*)_captcha/(d*)$ /index.php?s=index/myform/captcha&area=$1&id=$2 last;
	rewrite ^/search/$ /index.php?s=index/search/index last;
	rewrite ^/search/page/(d*)$ /index.php?s=index/search/index&page=$1 last;
	rewrite ^/(.*)_search/$ /index.php?s=index/search/index&area=$1 last;
	rewrite ^/(.*)_tag/([sS]*)$ /index.php?s=index/tag/index&title=$2&area=$1 last;
	rewrite ^/tag/([sS]*)$ /index.php?s=index/tag/index&title=$1 last;
	rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 last;
	rewrite ^/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 last;
	rewrite ^/(.*)/(.*)_(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2 last;
	rewrite ^/(.*)_(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1 last;
	rewrite ^/(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$2&ctitle=$1&cw=$3 last;
	rewrite ^/(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$2&ctitle=$1 last;
	rewrite ^/(.*)/(.*)_(.*)/$ /index.php?s=index/category/index&ctitle=$1/$3&area=$2 last;
	rewrite ^/(.*)_(.*)/$ /index.php?s=index/category/index&ctitle=$2&area=$1 last;
	rewrite ^/(.*)/(.*)_(.*)/page/(d*)$ /index.php?s=index/category/index&ctitle=$1/$3&area=$2&page=$4 last;
	rewrite ^/(.*)_(.*)/page/(d*)$ /index.php?s=index/category/index&ctitle=$2&area=$1&page=$3 last;
	rewrite ^/(.*)/$ /index.php?s=index/category/index&ctitle=$1 last;
	rewrite ^/(.*)/page/(d*)$ /index.php?s=index/category/index&ctitle=$1&page=$2 last;
	rewrite ^/(.*).html$ /index.php?s=index/index/index&area=$1 last;

云优系统默认自带iis环境的伪静态文件(web.config)。无需设置。如果没有则创建该文件,并将伪静态规则代码拷贝到文件里。

2:IIS环境

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="已导入的规则 1">
                    <match url="^(.*).(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/404.htm" />
                </rule>
                <rule name="已导入的规则 2" stopProcessing="true">
                    <match url="^phpMyAdmin/(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="phpMyAdmin/{R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 3" stopProcessing="true">
                    <match url="^404.htm$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/index/empty404" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 4" stopProcessing="true">
                    <match url="^admin/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=admin/{R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 5" stopProcessing="true">
                    <match url="^admin/(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=admin/{R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 6" stopProcessing="true">
                    <match url="^config/(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="/404.htm" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 7" stopProcessing="true">
                    <match url="^statics/ueditor/dialogs/(.*)/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="statics/ueditor/dialogs/{R:1}/{R:2}.html" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 8" stopProcessing="true">
                    <match url="^m/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/index/index" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 9" stopProcessing="true">
                    <match url="^m/myform/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/myform/index" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 10" stopProcessing="true">
                    <match url="^m/captcha/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/myform/captcha&amp;id={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 11" stopProcessing="true">
                    <match url="^m/search/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/search/index" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 12" stopProcessing="true">
                    <match url="^m/(.*)_search/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/search/index&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 13" stopProcessing="true">
                    <match url="^m/tag/([sS]*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/tag/index&amp;title={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 14" stopProcessing="true">
                    <match url="^m/(.*)_tag/([sS]*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/tag/index&amp;title={R:2}&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 15" stopProcessing="true">
                    <match url="^m/(.*)/(.*)_(.*)/(.*)_(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/show/index&amp;etitle={R:4}&amp;ctitle={R:1}/{R:3}&amp;area={R:2}&amp;cw={R:5}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 16" stopProcessing="true">
                    <match url="^m/(.*)_(.*)/(.*)_(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/show/index&amp;etitle={R:3}&amp;ctitle={R:2}&amp;area={R:1}&amp;cw={R:4}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 17" stopProcessing="true">
                    <match url="^m/(.*)/(.*)_(.*)/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/show/index&amp;etitle={R:4}&amp;ctitle={R:1}/{R:3}&amp;area={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 18" stopProcessing="true">
                    <match url="^m/(.*)_(.*)/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/show/index&amp;etitle={R:3}&amp;ctitle={R:2}&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 19" stopProcessing="true">
                    <match url="^m/(.*)/(.*)_(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/show/index&amp;etitle={R:2}&amp;ctitle={R:1}&amp;cw={R:3}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 20" stopProcessing="true">
                    <match url="^m/(.*)/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/show/index&amp;etitle={R:2}&amp;ctitle={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 21" stopProcessing="true">
                    <match url="^m/(.*)/(.*)_(.*)/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/category/index&amp;ctitle={R:1}/{R:3}&amp;area={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 22" stopProcessing="true">
                    <match url="^m/(.*)_(.*)/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/category/index&amp;ctitle={R:2}&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 23" stopProcessing="true">
                    <match url="^m/(.*)/(.*)_(.*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/category/index&amp;ctitle={R:1}/{R:3}&amp;area={R:2}&amp;page={R:4}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 24" stopProcessing="true">
                    <match url="^m/(.*)_(.*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/category/index&amp;ctitle={R:2}&amp;area={R:1}&amp;page={R:3}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 25" stopProcessing="true">
                    <match url="^m/(.*)/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/category/index&amp;ctitle={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 26" stopProcessing="true">
                    <match url="^m/(.*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/category/index&amp;ctitle={R:1}&amp;page={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 27" stopProcessing="true">
                    <match url="^m/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=wap/index/index&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 28" stopProcessing="true">
                    <match url="^index(.*)/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/index/index/{R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 29" stopProcessing="true">
                    <match url="^myform/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/myform/index" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 30" stopProcessing="true">
                    <match url="^(.*)_myform/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/myform/index&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 31" stopProcessing="true">
                    <match url="^captcha/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/myform/captcha&amp;id={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 32" stopProcessing="true">
                    <match url="^(.*)_captcha/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/myform/captcha&amp;area={R:1}&amp;id={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 33" stopProcessing="true">
                    <match url="^search/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/search/index" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 34" stopProcessing="true">
                    <match url="^search/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/search/index&amp;page={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 35" stopProcessing="true">
                    <match url="^search/key/(.*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/search/index&amp;key={R:1}&amp;page={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 36" stopProcessing="true">
                    <match url="^(.*)_search/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/search/index&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 37" stopProcessing="true">
                    <match url="^(.*)_search/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/search/index&amp;area={R:1}&amp;page={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 38" stopProcessing="true">
                    <match url="^(.*)_search/key/(.*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/search/index&amp;area={R:1}&amp;key={R:2}&amp;page={R:3}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 39" stopProcessing="true">
                    <match url="^(.*)_tag/([sS]*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/tag/index&amp;title={R:2}&amp;area={R:1}&amp;page={R:3}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 40" stopProcessing="true">
                    <match url="^(.*)_tag/([sS]*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/tag/index&amp;title={R:2}&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 41" stopProcessing="true">
                    <match url="^tag/([sS]*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/tag/index&amp;title={R:1}&amp;page={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 42" stopProcessing="true">
                    <match url="^tag/([sS]*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/tag/index&amp;title={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 43" stopProcessing="true">
                    <match url="^(.*)/(.*)_(.*)/(.*)_(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/show/index&amp;etitle={R:4}&amp;ctitle={R:1}/{R:3}&amp;area={R:2}&amp;cw={R:5}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 44" stopProcessing="true">
                    <match url="^(.*)_(.*)/(.*)_(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/show/index&amp;etitle={R:3}&amp;ctitle={R:2}&amp;area={R:1}&amp;cw={R:4}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 45" stopProcessing="true">
                    <match url="^(.*)/(.*)_(.*)/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/show/index&amp;etitle={R:4}&amp;ctitle={R:1}/{R:3}&amp;area={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 46" stopProcessing="true">
                    <match url="^(.*)_(.*)/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/show/index&amp;etitle={R:3}&amp;ctitle={R:2}&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 47" stopProcessing="true">
                    <match url="^(.*)/(.*)_(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/show/index&amp;etitle={R:2}&amp;ctitle={R:1}&amp;cw={R:3}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 48" stopProcessing="true">
                    <match url="^(.*)/(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/show/index&amp;etitle={R:2}&amp;ctitle={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 49" stopProcessing="true">
                    <match url="^(.*)/(.*)_(.*)/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/category/index&amp;ctitle={R:1}/{R:3}&amp;area={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 50" stopProcessing="true">
                    <match url="^(.*)_(.*)/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/category/index&amp;ctitle={R:2}&amp;area={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 51" stopProcessing="true">
                    <match url="^(.*)/(.*)_(.*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/category/index&amp;ctitle={R:1}/{R:3}&amp;area={R:2}&amp;page={R:4}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 52" stopProcessing="true">
                    <match url="^(.*)_(.*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/category/index&amp;ctitle={R:2}&amp;area={R:1}&amp;page={R:3}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 53" stopProcessing="true">
                    <match url="^(.*)/$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/category/index&amp;ctitle={R:1}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 54" stopProcessing="true">
                    <match url="^(.*)/page/(d*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/category/index&amp;ctitle={R:1}&amp;page={R:2}" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 55" stopProcessing="true">
                    <match url="^index.html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/index/index" appendQueryString="true" />
                </rule>
                <rule name="已导入的规则 56" stopProcessing="true">
                    <match url="^(.*).html$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php?s=index/index/index&amp;area={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
		<!--end-php-->
       </system.webServer>
</configuration>

3:阿里云增强虚拟主机nginx伪静态

登录阿里云空间面板-高级环境设置-NGINX设置 复制下面到配置框里即可,只适用于阿里云增强主机nginx环境,其他环境请勿适用。

参考教程:http://www.yunucms.com/technology/411.html

location / {
    rewrite ^/statics/ueditor/dialogs/(.*)/(.*).html$ /statics/ueditor/dialogs/$1/$2.html break;
    rewrite ^/phpMyAdmin/(.*)$ /phpMyAdmin/$1 last;
    rewrite ^/404.htm$ /index.php?s=index/index/empty404 last;
    rewrite ^/admin/(.*).html$ /index.php?s=admin/$1 last;
    rewrite ^/admin/(.*)$ /index.php?s=admin/$1 last;
    rewrite ^/config/(.*)$ /404.htm last;
    rewrite ^/m/$ /index.php?s=wap/index/index last;
    rewrite ^/m/myform/$ /index.php?s=wap/myform/index last;
    rewrite ^/m/captcha/(d*)$ /index.php?s=wap/myform/captcha&id=$1 last;
    rewrite ^/m/search/$ /index.php?s=wap/search/index last;
    rewrite ^/m/(.*)_search/$ /index.php?s=wap/search/index&area=$1 last;
    rewrite ^/m/tag/([sS]*)$ /index.php?s=wap/tag/index&title=$1 last;
    rewrite ^/m/(.*)_tag/([sS]*)$ /index.php?s=wap/tag/index&title=$2&area=$1 last;
    rewrite ^/m/(.*)/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 last;
    rewrite ^/m/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 last;
    rewrite ^/m/(.*)/(.*)_(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2 last;
    rewrite ^/m/(.*)_(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1 last;
    rewrite ^/m/(.*)/(.*)_(.*).html$ /index.php?s=wap/show/index&etitle=$2&ctitle=$1&cw=$3 last;
    rewrite ^/m/(.*)/(.*).html$ /index.php?s=wap/show/index&etitle=$2&ctitle=$1 last;
    rewrite ^/m/(.*)/(.*)_(.*)/$ /index.php?s=wap/category/index&ctitle=$1/$3&area=$2 last;
    rewrite ^/m/(.*)_(.*)/$ /index.php?s=wap/category/index&ctitle=$2&area=$1 last;
    rewrite ^/m/(.*)/(.*)_(.*)/page/(d*)$ /index.php?s=wap/category/index&ctitle=$1/$3&area=$2&page=$4 last;
    rewrite ^/m/(.*)_(.*)/page/(d*)$ /index.php?s=wap/category/index&ctitle=$2&area=$1&page=$3 last;
    rewrite ^/m/(.*)/$ /index.php?s=wap/category/index&ctitle=$1 last;
    rewrite ^/m/(.*)/page/(d*)$ /index.php?s=wap/category/index&ctitle=$1&page=$2 last;
    rewrite ^/m/(.*).html$ /index.php?s=wap/index/index&area=$1 last;
    rewrite ^/index(.*)/$ /index.php?s=index/index/index/$1 last;
    rewrite ^/myform/$ /index.php?s=index/myform/index last;
    rewrite ^/(.*)_myform/$ /index.php?s=index/myform/index&area=$1 last;
    rewrite ^/captcha/(d*)$ /index.php?s=index/myform/captcha&id=$1 last;
    rewrite ^/(.*)_captcha/(d*)$ /index.php?s=index/myform/captcha&area=$1&id=$2 last;
    rewrite ^/search/$ /index.php?s=index/search/index last;
    rewrite ^/search/page/(d*)$ /index.php?s=index/search/index&page=$1 last;
    rewrite ^/search/key/(.*)/page/(d*)$ /index.php?s=index/search/index&key=$1&page=$2 last;
    rewrite ^/(.*)_search/$ /index.php?s=index/search/index&area=$1 last;
    rewrite ^/(.*)_search/page/(d*)$ /index.php?s=index/search/index&area=$1&page=$2 last;
    rewrite ^/(.*)_search/key/(.*)/page/(d*)$ /index.php?s=index/search/index&area=$1&key=$2&page=$3 last;
    rewrite ^/(.*)_tag/([sS]*)/page/(d*)$ /index.php?s=index/tag/index&title=$2&area=$1&page=$3 last;
    rewrite ^/(.*)_tag/([sS]*)$ /index.php?s=index/tag/index&title=$2&area=$1 last;
    rewrite ^/tag/([sS]*)/page/(d*)$ /index.php?s=index/tag/index&title=$1&page=$2 last;
    rewrite ^/tag/([sS]*)$ /index.php?s=index/tag/index&title=$1 last;
    rewrite ^/(.*)/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 last;
    rewrite ^/(.*)_(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 last;
    rewrite ^/(.*)/(.*)_(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2 last;
    rewrite ^/(.*)_(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1 last;
    rewrite ^/(.*)/(.*)_(.*).html$ /index.php?s=index/show/index&etitle=$2&ctitle=$1&cw=$3 last;
    rewrite ^/(.*)/(.*)_(.*)/$ /index.php?s=index/category/index&ctitle=$1/$3&area=$2 last;
    rewrite ^/(.*)_(.*)/$ /index.php?s=index/category/index&ctitle=$2&area=$1 last;
    rewrite ^/(.*)/(.*)_(.*)/page/(d*)$ /index.php?s=index/category/index&ctitle=$1/$3&area=$2&page=$4 last;
    rewrite ^/(.*)_(.*)/page/(d*)$ /index.php?s=index/category/index&ctitle=$2&area=$1&page=$3 last;
    rewrite ^/(.*)/$ /index.php?s=index/category/index&ctitle=$1 last;
    rewrite ^/(.*)/page/(d*)$ /index.php?s=index/category/index&ctitle=$1&page=$2 last;
    rewrite ^/index.html$ /index.php?s=index/index/index last;
    rewrite ^/(.*)/(.*).html$ /index.php?s=index/show/index&etitle=$2&ctitle=$1 last;
    rewrite ^/(.*).html$ /index.php?s=index/index/index&area=$1 last;
}

location ~ /.ht {
    deny all;
}

4:百度独立主机

因为百度独立主机只支持Nginx + PHP 5.2/5.3/5.4/5.6/7.0,所以需要以下2个步骤

1、需要关闭空间自带的缓存加速功能

2、然后新建文件bcloud_nginx_user.conf,放置FTP站点目录下

bcloud_nginx_user.conf文件内容如下

 location / { 
	if (!-d $request_filename){
		set $rule_0 1$rule_0;
	}
	if (!-f $request_filename){
		set $rule_0 2$rule_0;
	}
	if ($rule_0 = "21"){
		rewrite ^/(.*).(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.htm;
	}
	rewrite ^/admin/(.*).html$ /index.php/admin/$1 last;
	rewrite ^/admin/(.*)$ /index.php/admin/$1 last;
	rewrite ^/m/$ /index.php/wap/index/index last;
	rewrite ^/m/(.*)_(.*)/(.*)_(.*).html$ /index.php/wap/show/index?etitle=$3&area=$1&cw=$4 last;
	rewrite ^/m/(.*)_(.*)/(.*).html$ /index.php/wap/show/index?etitle=$3&area=$1 last;
	rewrite ^/m/search/$ /index.php/wap/search/index last;
	rewrite ^/m/myform/$ /index.php/wap/myform/index last;
	rewrite ^/m/captcha/(.*)$ /index.php/wap/myform/captcha?id=$1 last;
	rewrite ^/m/(.*)_search/$ /index.php/wap/search/index?area=$1 last;
	rewrite ^/m/(.*)/(.*)_(.*).html$ /index.php/wap/show/index?etitle=$2&cw=$3 last;
	rewrite ^/m/(.*)_tag/([sS]*)$ /index.php/wap/tag/index?title=$2&area=$1 last;
	rewrite ^/m/tag/([sS]*)$ /index.php/wap/tag/index?title=$1 last;
	rewrite ^/m/(.*)/(.*).html$ /index.php/wap/show/index?etitle=$2 last;
	rewrite ^/m/(.*)_(.*)/$ /index.php/wap/category/index?ctitle=$2&area=$1 last;
	rewrite ^/m/(.*)_(.*)/page/(.*)$ /index.php/wap/category/index?ctitle=$2&area=$1&page=$3 last;
	rewrite ^/m/(.*)/$ /index.php/wap/category/index?ctitle=$1 last;
	rewrite ^/m/(.*)/page/(.*)$ /index.php/wap/category/index?ctitle=$1&page=$2 last;
	rewrite ^/m/(.*).html$ /index.php/wap/index/index?area=$1 last;
	rewrite ^/statics/ueditor/dialogs/(.*)/(.*).html$ /statics/ueditor/dialogs/$1/$2.html last;
	rewrite ^/index(.*)/$ /index.php/index/index/index/$1 last;
	rewrite ^/(.*)_(.*)/(.*)_(.*).html$ /index.php/index/show/index?etitle=$3&area=$1&cw=$4 last;
	rewrite ^/(.*)_(.*)/(.*).html$ /index.php/index/show/index?etitle=$3&area=$1 last;
	rewrite ^/search/$ /index.php/index/search/index last;
	rewrite ^/myform/$ /index.php/index/myform/index last;
	rewrite ^/captcha/(.*)$ /index.php/index/myform/captcha?id=$1 last;
	rewrite ^/search/page/(.*)$ /index.php/index/search/index?page=$1 last;
	rewrite ^/(.*)_search/$ /index.php/index/search/index?area=$1 last;
	rewrite ^/(.*)/(.*)_(.*).html$ /index.php/index/show/index?etitle=$2&cw=$3 last;
	rewrite ^/(.*)/(.*).html$ /index.php/index/show/index?etitle=$2 last;
	rewrite ^/(.*)_tag/([sS]*)$ /index.php/index/tag/index?title=$2&area=$1 last;
	rewrite ^/tag/([sS]*)$ /index.php/index/tag/index?title=$1 last;
	rewrite ^/(.*)_(.*)/$ /index.php/index/category/index?ctitle=$2&area=$1 last;
	rewrite ^/(.*)_(.*)/page/(.*)$ /index.php/index/category/index?ctitle=$2&area=$1&page=$3 last;
	rewrite ^/(.*)/$ /index.php/index/category/index?ctitle=$1 last;
	rewrite ^/(.*)/page/(.*)$ /index.php/index/category/index?ctitle=$1&page=$2 last;
	rewrite ^/(.*).html$ /index.php/index/index/index?area=$1 last;

}

 

    转载请注明来源网址:https://www.xiuzhanwang.com/yunucms_az/4221.html

    发表评论

    评论列表(条)

       
      QQ在线咨询
      VIP限时特惠