Linux. htaccess set 301 Jump to www method

Source: Internet
Author: User
The code is as follows Copy Code

1.RewriteCond%{http_host} ^111cn.net$ [NC]
2.RewriteRule ^ (. *) $ http://www.111cn.net/$1 [l,r=301]

. htaccess set 301 method, old domain name to new domain name

To set the method:

The code is as follows Copy Code

Rewriteengine on
Rewritecond%{http_host} ^olddomain.com [Nc,or]
Rewritecond%{http_host} ^www.olddomain.com [NC]
Rewriterule ^ (. *) $ http://www.newdomain.com/$1 [l,r=301]

Second: The domain name redirects to the new domain name of the website two level directory Mulu:

According to the site code:

  code is as follows copy code

Rewriteengine On
Rewritecond%{http_host} ^old.com [Nc,or]
Rewritecond%{http_host} ^www.old.com [NC]
Rewriterule ^ (. *) $ http://www.new.com/mulu/$1 [l,r=301]

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.