织梦让 http:///m 重定向到 http://m.

织梦网站二级目录301重定向到二级域名伪静态规则各种环境下的写法

以下规则放在主域名规则文件里

IIS7+ (web.config)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
<rule name="二级目录301重定向到二级域名" stopProcessing="true">
<match url="^m/(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="http://m./{R:1}"/>
</rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


Apache (.htaccess)

RewriteEngine On
RewriteBase /
RewriteRule ^m/(.*)$ http://m.123.com/$1 [R=301,L]


Nignx (nginx.conf)

location ~* ^/m/ {
rewrite ^/m/(.*)$ http://m.123.com/$1 permanent;
}