Modify. htaccess Implementation 301 redirect

Source: Internet
Author: User
Tags php email cpanel net domain sub domain to domain

1. Direct editing. htaccess. qq:452572701

2. Set with cpanel. Reprint Please specify: ZEROSKYHK blog

In essence both are modified documents. htaccess, just the former hand-edited, the latter is done by cpanel. With cpanel operation is quite simple, landing your cpanel–>domain–>redirects, select the appropriate options to complete the settings, here is not discussed. Let's talk about direct editing. Htaccess method. qq:452572701

Note: Be sure to back up the. htaccess file in the corresponding directory before you set 301 redirection. Reprint Please specify: ZEROSKYHK blog

1. REDIRECT domain.com to www.domain.com reprint please specify: Zkblog

This redirect is designed to make the domain name unique, is the website SEO must do, the back redirects www.domain.com to domain.com is also for the same reason, but the form is different. Open the. htaccess file and add the following rules. (The following rules are for the main domain name, the sub domain name to be modified) reprint please specify: Zkblog

Rewriteengine on
Rewritecond%{http_host}!^www.domain.com$ [NC]
Rewriterule ^ (. *) $ http://www.domain.com/$1 [l,r=301] By:zeroskyhk.com

2. redirect www.domain.com to domain.com email:zeroskyhk@qq.com

Rewriteengine on
Rewritecond%{http_host}!^domain.com$ [NC]
Rewriterule ^ (. *) $ http://domain.com/$1 [l,r=301] Reprint please specify: www.zeroskyhk.com

3. redirect olddomain.com to Www.111cn.net By:zeroskyhk.com

Rewriteengine on
Rewritecond%{http_host}!olddomain.com$ [NC]
Rewriterule ^ (. *) $ http://www.111cn.net/$1 [l,r=301] qq:452572701

4. REDIRECT olddomain.com to 111cn.net reprint please specify: Zkblog

Rewriteengine on
Rewritebase/
Rewritecond%{http_host}!olddomain.com$ [NC]
Rewriterule ^ (. *) $ http://111cn.net/$1 [l,r=301] Reprint please specify: ZEROSKYHK blog

5. redirect domain.com/file/file.php to otherdomain.com/otherfile/other.php email:zeroskyhk@qq.com

Rewritecond%{http_host} ^www.domain.com$
Rewriterule ^file/file.php$ http://www.otherdomain.com/otherfile/other.php [r=301,l] By:zeroskyhk.com

=================================
Amount, no intention to go to the home of the webmaster check the next PR, found 111cn.net domain only included a few pages can googlepr since is 2 ... I got a go = =#
Decisive 301 come over zeroskyhk.com domain!!! Reprint Please specify: ZEROSKYHK blog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.