网站二级目录自动跳转到二级域名的伪静态规则,可实现网站二级目录301重定向到二级域名。
例如:让 https://www.uu2018.com/abc 重定向到 http://abc.uu2018.com。
以下伪静态规则放在主域名规则文件里即可:
一、IIS7+ (web.config)
- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rules>
- <rule name="二级目录301重定向到二级域名" stopProcessing="true">
- <match url="^abc/(.*)$" ignoreCase="false" />
- <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
- <action type="Redirect" url="http://abc.123.com/{R:1}"/>
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
二、Apache (.htaccess)
- RewriteEngine On
- RewriteBase /
- RewriteRule ^abc/(.*)$ http://abc.123.com/$1 [R=301,L]
三、Nignx (nginx.conf)
- location ~* ^/abc/ {
- rewrite ^/abc/(.*)$ http://abc.123.com/$1 permanent;
- }
收藏
发表评论 快来秀出你的观点