dede5.7 How to add 301 redirects

Source: Internet
Author: User

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

I am not here to talk about the site 301 Redirect to the site's optimization has how many benefits, I believe that want to do their own site to redirect friends, certainly to 301 redirect already has a deep, otherwise it will not easily to their own site to join this dongdong.

About the domain name without the WWW and Space provider 3. Class of domain name will be dispersed site weight of the article a lot, here not to say, 3. class domain name refers to the space provider to your domain name.

DEDE5.7 's program has its own index.php.

This is generally true:

<?php

/**

* @version $Id: index.php 1 9:23 2010-11-11 Tianya $

* @package Dedecms.site

* @copyright Copyright (c) 2007-2010, Desdev, Inc.

*/

if (!file_exists dirname (__file__). /data/common.inc.php '))

{

Header (' location:install/index.php ');

Exit ();

}

Here, change the code to 301 redirect code.

?>

Implement 301 redirect

Replace the original index.php content with the following code:

<?php

/**

* @version $Id: index.php 1 9:23 2010-11-11 Tianya $

* @package Dedecms.site

* @copyright Copyright (c) 2007-2010, Desdev, Inc.

*/

$HOST =$_server[' Http_host '];

if ($HOST = = "XXX.com" | | $HOST = = "Xxx.tzs58112601697931.001host.net") {

Header ("http/1.1 moved Permanently");

Header ("location:http://www.xxx.com");

Exit ();

}

if (!file_exists dirname (__file__). /data/common.inc.php '))

{

Header (' location:install/index.php ');

Exit ();

//Replace the red text section above with this green code. In this code, the red part, the front one is your domain name without www, the following is a space provider's domain name, as long as the two changes, 301 redirect to do.

?>

You can copy the above code directly into the index.php in the root directory of dede5.7, overwriting the previous source.

How to see if your 301 redirects add success

Can pass through Love Station network IP counter check function to inquire, home open Love Station network, find the domain name back check function, enter your domain name, you can check a lot of the same IP below the site, here you just find your own two domain name can be, one is with www, one is not with www. The exact steps are as shown in the figure:

  

Of course this kind of test gives you a feeling is not intuitive, there is a simpler way. If your 301 redirect is successful, you can enter the domain name without www to the address bar of the browser, it will automatically jump to the domain name with www (this method does not provide a demo, as long as the 301-directional success, will see the effect).

Magical Place

There is a very magical place, is that I did not take the WWW to the domain name with the WWW, my visit to the traffic increased a lot. To map as proof, I was 12th to do 301 directional, to the back of the number of IP is increasing, this may be redirected, the domain name without the WWW traffic, statistics to take the www.

  

This article by "Interesting Pick Knowledge Network" collation compilation, reprinted on the note. This article URL: http://www.qutzs.com/dedecms/dedehack/201205/1240.html

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.