Using 301 Redirect to solve the problem of weight dispersion

Source: Internet
Author: User
Keywords Website optimization
Tags analysis code content dedecms default domain domain name exchange links

These days in a webmaster group several times to see the discussion about the site 301 redirect problem, in the process of discussion, learned a lot of how to set the site's 301 redirect script, but also summed up their previous station did not notice the details, here, the content summarized and shared to the vast number of webmaster friends.

Here, I mainly for Linux host under the use of Dedecms Web site for 301 redirect analysis (mainly using the. htaccess file to set redirects), one because space is limited, two is so more targeted, if it is to use other ways to stand friends, According to their own actual situation to make corresponding changes and settings, this article only provides a method, a way of thinking.

I. Establishment of. htaccess files

Under the local Windows platform, it is not possible to create a. htaccess file directly, the system prompts you to fill in the file name because for win, the file name ". htaccess" is a file with only a file suffix and no file name, but under Linux, This file is a system file. The solution is, first use FTP on the server to create a. htaccess file, and then download to the local host editor, file download down, is allowed to modify, the above situation will not appear. This question has been bothering me for a long time, and here's a note of how it might be good for a friend who is not familiar with the htaccess file.

Second, centralized root domain name and two-level domain name weight

Novice Webmaster sometimes to similar to www.xxxx.com and xxxx.com the weight of the two domain name more puzzled, in the beginning of the site may be in the end to choose which as the main domain name. I think that the highest level of top-level domain name, that is, cytao.com weight than the other two-level domain name, so, select the domain name, the top-level domain is a good choice. However, with the WWW two-level domain name more in line with the user's habits, it seems to feel pleasing to the point (purely personal opinion), so, if the choice of two domain name as the main domain name, we have to the other domain name (including top-level domain name) weight transferred to the main domain name, The solution to this problem is to add two lines of 301 redirect code to the. htaccess file, and the code gives the sample below.

Third, the resolution of the site's default page weight dispersion problem

Because of their familiarity with Dedecms, previously built stations are used in its architecture. Until one day, with another webmaster exchange links, he told me, my website has a jump, access to www.xxxx.com when the jump to www.xxxx.com/index.html, so refused to exchange links with me. So I found that Dedecms's default home page is index.php, this file first to determine whether there is a static home file, if there is, then jump. So I stood on the jump to the static file. Then I thought, in fact, this is the site's default page Setup problem, as long as the default page file name and order in the. htaccess file is ok. Recommended to build a station with CMS friends, go back to check their own station whether there is such a situation and make corresponding changes.

The following gives me the station of the. htaccess file code, friends can refer to:

Options +followsymlinks

Rewriteengine on

DirectoryIndex index.html index.htm index.php

Rewritecond%{http_host} ^cytao.com [NC]

Rewriterule ^ (. *) $ http://www.cytao.com/$1 [R=301,NC]

ErrorDocument 404/404.htm

Note: The blank line between the lines above and the line cannot be deleted, otherwise there will be an error; The DirectoryIndex file order must be set according to the circumstances of your site.

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.