Perform 301 redirection on the website under the Centos server

Source: Internet
Author: User
Tags centos server zen cart
What is 301 redirection? Centoscn.com. Enter the domain name centoscn.com in the IE browser and automatically jump to the second-level domain name www.centoscn.com. this is called website 301 redirection, which is called website redirection. Now, click centoscn.com. this is 301.
Is website 301 redirection restricted by the environment? I think there is no environment restriction for 301 Redirection. as long as it is a virtual host, whether it is a php virtual host in linux or a php space in windows, you can find the method to implement 301 redirection, but the method and method are different. In linux, website 301 redirection is simpler, more flexible, and more convenient. We recommend that you select the php space in the linux environment as much as possible. The linux environment can better support php and more php extension functions (such as 301 and gzip ), this is an inherent advantage of linux. it is difficult to implement a windows system. even if it can, the process is tortuous and the efficiency is not high. Windows does not work on php. asp and asp.net are inherent advantages of windows. Select a space. In a pure linux environment, how does one implement the 301 feature? The. htaccess pseudo-static rule file is used to implement the 301 function, which is the first choice for linux space to implement the 301 function. If you do not know what. htaccess is? To implement the 301 feature, you must create a new. htaccess file. if you do not have this file on your website, please continue reading it. Make preparations before configuring website 301 Redirection. follow the prompts to make the following preparations: 1. confirm domain name resolution. Make sure that the primary (root) domain name (such as centoscn.com) and the second-level domain name (such as www.centoscn.com) of www have been resolved to the space IP address and have taken effect. this is required. 2. confirm that the website domain name has been bound to the space control panel. 3. check whether the website can be accessed normally. you can access the website through a domain name (with or without www. 4. check whether your website is pseudo-static. If the file is pseudo-static, there will be a. htaccess file under the root directory of the website (public_html. How to create? Continue reading and you will be able to find a solution. How to configure the 301 redirection function is very simple, that is, the two rules are solved. You only need to "draw images from the gourd tree. The two rules are: RewriteCond % {HTTP_HOST} ^ centoscn.com $ [NC] RewriteRule ^ (. *) $ http://www.centoscn.com/ $1 [L, R = 301] rules: 1. replace the domain name in the above rules with your own website domain name. 2. copy the rules directly to notepad. 3. rules should be sometimes divided into two situations. In the first case, the website has been pseudo-static. in the second case, the website has not been pseudo-static. In other words, whether. htaccess exists in the root directory of your website directory. If yes, insert the rule directly. if not, create a new one and upload it to the root directory of the space. From here on, many people are confused. where is the. htaccess file? Where is the rule inserted? How to edit the. htaccess file? Where can I upload files? How to put rules in and so on. This is what many people do not know. it is also the most frequently asked questions we have asked during our after-sales work. Next I will discuss the details separately (don't abandon me ??? P ). Let's take a look at how to edit the. htaccess file first, "How to edit the. htaccess file ?", Edit. htaccess file, you can use any editor, notepad, editplus, dw, and other web editing tools you think of, you can perform the following steps to implement the 301 function on the website: 1. in the first case, the website has been pseudo-static (already available. htaccess file site ). If the website is pseudo-static, A. htaccess file is usually located under the root directory of the website (public_html). It is very convenient to implement 301. Log on to ftp and download the. htaccess rule to your local computer. open it in a text editor and find "RewriteBase/". Insert the two rules for the above 301 redirection to the bottom of "RewriteBase. 2. in the second case, websites do not have the pseudo-static and 301 functions, and are implemented using. htaccess rules. your website does not have the pseudo-static file, and generally does not exist. If you confirm that the root directory of your website does not exist. the htaccess file needs to be manually created. if this is the case, configure the file according to the following description: 301 redirection rules (this rule applies to space in any linux environment): RewriteEngine On RewriteBase/RewriteCond % {HTTP_HOST} ^ centoscn.com $ [NC] RewriteRule ^ (. *) $ http://www.centoscn.com/ $1 [L, R = 301] create a notebook on your computer, copy and paste the above rules into the notebook, replace the domain name in the rule with your domain name and save it. Note: files with empty names cannot be saved in windows. when you use files such as htaccess, your operating system reports an error. please do not keep yourself confused. enter any name to save it. Connect to ftp, upload the file to the root directory of the website (public_html), and rename it. htaccess. For more information about how to create a. htaccess file, see Section 301. In the linux system environment, it is very simple to implement 301 in the php space. do not be afraid. There are two rules and they can be placed in the right place. many people are unfamiliar with linux environment hosts, so they use a lot of text to explain in detail. This rule applies to space usage in any linux environment and is suitable for any open-source program, whether you use disucz! X2, joomla, dedecms, shopex, ecsohp, and zen cart can be used for online stores.
Related Article

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.