首页 > 问答 > 这么写htaccess301规则,为什么内容页不跳转,只目录跳转

这么写htaccess301规则,为什么内容页不跳转,只目录跳转

[导读]:RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www.olddomain.com$ [NC] RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301] 只有首页和目录页面301重定向,文章页面(以.html结尾的页面)不跳转!...

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.olddomain.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]
只有首页和目录页面301重定向,文章页面(以.html结尾的页面)不跳转!
如何写htaccess规则使全站所有页面301重定向?

rewriteCond %{http_host} ^seowhy.com [NC]

rewriteRule ^(.*)$ http://www.seowhy.com /$1 [R=301,L]

第一行表示开启urlrewrite

第二三行表示将 seowhy.com 后面的任何链接形式定向到 www.seowhy.com对应的链接 

如seowhy.com/news/52.html将会对应到www.seowhy.com/news/52.html

所以你的规则是对的,你现在没有出现的跳转是什么样子,你想实现哪种方式,可以加我qq5167603给你看看

本文来自投稿,不代表微盟圈立场,如若转载,请注明出处:https://www.vm7.com/a/ask/29897.html