Web hosting and domain names bound pseudo-static rule 301 Jump .htaccess 301 redirect

.htaccess apache This module is regarded as one called it expanded to show the template,To make it possible to run must RewriteEngine:Let's rewrite the following features on or off。on open;is closed off,Possible。

Redirect Old domain name .com to www. New domain name .com.

 

Code is as followsCopy the code

RewriteEngine On
RewriteCond %{HTTP_HOST} !Old domain name .com $ [NC]
RewriteRule ^(.*)$ http://www. new domain name .com / $ 1 [L,R=301]

Redirect Old domain name .com to the new domain name .com

Code is as followsCopy the code

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !Old domain name .com $ [NC]
RewriteRule ^(.*)$ http://The new domain name .com / $ 1 [L,R=301]

重定向domain.com/file/file.php 到 otherdomain.com/otherfile/other.php

Code is as followsCopy the code

RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^file/file.php$ http://www.otherdomain.com/otherfile/other.php [R = 301, L]

RewriteBase /news
RewriteCond %{HTTP_HOST} ^www.111cn.net [NC]
RewriteRule com(.*)$ http://www.111cn.net$1 [L,R=301]

#Not slash the requested address is /wwwroot/www.111cn.net/news/

Code is as followsCopy the code

RewriteCond %{HTTP_HOST} ^www.111cn.net [NC]
RewriteRule (.*)$ http://www.111cn.net/news/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC]
RewriteRule com(.*)$ http://www.111cn.net$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^124.173.133.154 [NC]
RewriteRule (.*)$ http://www.111cn.net/news/$1 [L,R=301]

# Modify the following statement / discuz address for your Groups directory,If the program is placed in the root directory,Please / discuz modify /
RewriteBase /

# Rewrite rules do not modify the system

Code is as followsCopy the code

RewriteCond %{HTTP_HOST} !^www.111cn.net$ [NC]
RewriteRule ^(.*)$ http://www.111cn.net/$1 [L,R=301]
RewriteRule ^archiver/((in|time)-[w-]+.html)$ archiver/index.php?$1
RewriteRule ^forum-([0-9]+)-([0-9]+).html $ forumdisplay.php?at $ 1 =&page=$2
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+).html $ viewthread.php?Time = $ 1&extra=page=$3&page=$2
RewriteRule ^space-(username|uid)-(.+).html$ space.php?$1=$2
RewriteRule ^tag-(.+).html$ tag.php?name=$1

[NC]:no case of abbreviations。Means ignore case,a-z and A-Z is no difference。
[NC,OR]:OR=AND。It meant to be followed under a grammatical sentence。
[R = 301, L]:R=301:redirect Abbreviation。It means using the 301 permanent steering (when the URL in the list above,Automatically redirected to the URL you specify);L:Last Abbreviation,Meaning that the last sentence。

Leave a Comment