Configuration code for htaccess 301 redirection in the secondary directory

WBOY
Release: 2016-07-25 09:00:33
Original
1158 people have browsed it
二级目录下的页面,子目录下也存在htaccess文件,配置有自己的规则,根目录的301跳转规则对子目录无效,需要在子目录下重作301重定向。

(301重定向)子目录与根目录的不同之处: 访问地址后面有没有加斜杠所请求的地址会有不同,规则如下:

RewriteBase /news
RewriteCond %{HTTP_HOST} ^jbxue.com [NC]
RewriteRule com(.*)$ http://bbs.it-home.org$1 [L,R=301]
#不加斜杠请求的地址是/wwwroot/jbxue.com/news/
RewriteCond %{HTTP_HOST} ^jbxue.com [NC]
RewriteRule (.*)$ http://bbs.it-home.org/news/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^192.168.8.88 [NC]
RewriteRule com(.*)$ http://bbs.it-home.org$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^192.168.8.88 [NC]
RewriteRule (.*)$ http://bbs.it-home.org/news/$1 [L,R=301]
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!