AMH panel configuration site 301 Jump www and no www domain name example

Source: Internet
Author: User
Tags ini
When we build the station will be based on their own habits with the www or without the WWW domain name as the main domain name, for this point is not too much of a strict requirement is to use WWW or non-www domain name, but in foreign sites to see more than the WWW site, And our domestic is more inclined to practical with the WWW domain name site.

At the same time, in a lot of so-called Web site optimization theory, some so-called master mentioned that must be carried out 301 jump, if the use of WWW will be to the non-www jump to the WWW domain name, otherwise the so-called weight will be lost. The specific is not really old left is also not clear, because some users mentioned that when using the AMH panel, do not know how to set 301 jump, because you may be accustomed to use the Apache environment directly in the. htaccess file settings.

The AMH panel uses the Nginx environment, so similar to the LNMP one-key package environment, can be directly modified. Conf configuration file for 301 Jump Settings (LNMP series Tutorial Five: Set 301 redirect method). If we're using the AMH panel, that's what we need to do.

First, if you use the WordPress program

If we use the WordPress program, the old left discovery does not need to set 301 will automatically jump, this in the AMH panel environment is such, but in the LNMP environment is not such, may be the internal environment of the mechanism and WP system default structure is related. We need to create WP site, if the use of WWW directly to open the installation, the default all jump to the WWW domain name. If we need to modify, directly in the WP background site settings to set whether with the WWW as the primary domain name.

Second, other procedural environment

Other environment, we are still the same, modify the corresponding site. conf file. Found it:

The code is as follows Copy Code

/usr/local/nginx/conf/vhost/

Directory file, locate the. conf file that corresponds to the site's domain name, such as laozuo.org.conf

See above, we add in the corresponding position:

The code is as follows Copy Code

if ($host!= ' www.111cn.net ') {
Rewrite ^/(. *) $ http://www.111cn.net/$1
permanent;
}

The script above can be modified to the URL of our own site. If we need to do without www, corresponding to remove the WWW can be achieved, and finally need to implement AMH Nginx Restart restart Nginx can be effective.

Using pseudo static Httpd.ini to implement 301 redirection under IIS

One, not in the background to open pseudo static, using a static page or dynamic page
[Isapi_rewrite]

# 3600 = 1 hour
Cacheclockrate 3600
Repeatlimit 32
Rewritecond Host: ^111cn.net$
Rewriterule (. *) http://www.111cn.net$1 [I,RP]

Create a new text document and change the filename and suffix to: httpd.ini (Windows system typically sets the visible file suffix or can modify the real file suffix)
Paste the above code into the Httpd.ini file, and be sure to carefully change the above code, the 111cn.net to your domain name, such as abc.com, attention. The front also needs (the bottom two lines need to do the same change).
After saving, log on to FTP, upload the file to your site's root directory, and then you are done, visit the site to try it!

Second, if the site in the background to open pseudo static

Log in to FTP, find the root of the Httpd.ini file, download to the local, edit the file, in line 4th Repeatlimit 32 New Line (note Do not move the following code), the following copy paste into the new line:

Rewritecond Host: ^111cn.net$

Rewriterule (. *) http://www.111cn.net$1 [i,r]

Then, be sure to change the 111cn.net to your domain name, such as abc.com, note. The front is also needed.
After saving, log in to FTP, upload the file to your site's root directory, and then it's done, visit the site to try it!

using the. htaccess to achieve 301 redirects under Apache

First, does not open the pseudo static function

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

Create a new text document and change the filename and suffix to:. htaccess (Windows system typically sets the visible file suffix or can modify the real file suffix)
Paste the above code into the. htaccess file, and be sure to change the above code carefully, and change the 111cn.net to your domain name, such as ABC.com.
After saving, log in to FTP, upload the file to your site's root directory, you can.

Second, the pseudo static function has been opened

Log in to FTP, locate the. htaccess file in the root directory, download to local, edit the file, Rewriteengine on line 1th (note that the following code is not moving), and paste the following copy into the new line:

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

Then, be sure to change the 111cn.net to your domain name, such as ABC.com.
After saving, log in to FTP, upload the file to your site's root directory, you can.

To sum up, the above simple recording method puts the AMH panel using the user needs to record the site 301 jump, so that there is a need for friends to copy reference use.

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.