2017-08-08 13:57:35 httpd.ini web.config .htaccess 三种伪静态文件301单页面永远重定向跳转规则写法,网站改版域名更换的301大家都应该比较熟悉,网络上也特别多,那么遇到网页中某个目录改变或某个单页面改
httpd.ini web.config .htaccess 三种伪静态文件301单页面永远重定向跳转规则写法,网站改版域名更换的301大家都应该比较熟悉,网络上也特别多,那么遇到网页中某个目录改变或某个单页面改网址需要301永久重定向规则写法。
1、原来单一地址:
yfnd.net/rumen/r123.shtml
301跳转为:
//www.yfnd.net/css/123.shtml
2、原来一个目录地址:
yfnd.net/rumen/
301跳转为:
//www.yfnd.net/css/
1、httpd.ini文件内写法
[ISAPI_Rewrite]# 3600 = 1 hour
CacheClockRate 3600RepeatLimit 32
RewriteRule /rumen/r123\.shtml$ /css/123.shtml [I,R]
RewriteRule /rumen/$ /css/ [I,R]
2、 .htaccess 文件301跳转写法
RewriteEngine on
RewriteBase /
redirect 301 /rumen/r123.shtml //www.yfnd.net/css/123.shtml
redirect 301 /rumen/ //www.yfnd.net/css/
3、 web.config文件301跳转写法对应规则伪静态那部分代码
<rewrite>
<rules> <rule name="301r 1" stopProcessing="true">
<match url="^rumen/r123.shtml" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="//www.yfnd.net/css/123.shtml" />
</rule>
<rule name="301r 2" stopProcessing="true">
<match url="^rumen/" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="//www.yfnd.net/css/" />
</rule> </rules> </rewrite>
需要注意有的301跳转目标地址需要完整http网址。