The way to redirect all pages in the old station to the new site in 301

Source: Internet
Author: User
Keywords 301 redirect
Tags abstract blog change change the domain name code domain domain name file

Abstract: Blog replacement domain name and space is nearly six months ago, then just the old station home made 301 Redirect to the new station home, and then did not take care of the old station. The last two days when reading blog statistics, suddenly think of the old station has been

Blog change domain name and space is nearly six months ago, then just the old station home made 301 Redirect to the new station home, and then did not take care of the old station. The last two days in reading the blog statistics when suddenly think of actually the old station has been running, do not know that there are no people to visit. Do not see do not know, read later found that the original months past, the old station has been enjoying every day the search engine for her fresh flow, although not a lot, but very stable.

In order not to waste these flows, so hurriedly took some measures to the old station inside the page also redirected to the new station. Of course, is also to jump to the new station's homepage. In fact, I most want is the old station article page and the new station article page one by one correspondence, had thought to pass the article ID the form correspondence, but because the new old site URL format is completely different, I really did not find the feasible method, also did not know whether can do so. Next to the need to help friends to introduce me to the old blog station most of the page (basically covers all the engine can be included in the page) redirect to the new station home method.

For the problem: do the new and old site 301 Redirect, only the first page jump, but can not jump inside the page, resulting in the search engine included pages still point to the old station.

Effect: When clicked on any display in the search engine's old station page will jump to the new station homepage (you may also specify jumps to the new station other page).

Description: This site old domain name: www.tiotip.com new domain name: www.newpm.net Please according to your actual domain name will appear in the following code the domain name to make the corresponding replacement. This method is suitable for web-site programs such as WordPress, PHP as a coding language.

Method:

1. Home jump.

Write the following code into the. htaccess file in the root directory of the site's space:

Options +followsymlinks

Rewriteengine on

Rewritecond%{http_host} ^tiotip.com$ [OR]

Rewritecond%{http_host} ^www.tiotip.com [NC]

Rewriterule ^ (. *) $ http://www.newpm.net/$1 [l,r=301]

Upload overlay after saving. To this old station home can jump to the new station home page.

2. Internal page jump.

Write the following code in the inner page file that you want to jump (I wrote at the top of the file):

I wrote this code in the following file (in the subject file): 404.php (404 pages), archive.php (category archive page), page.php (Standalone page), single.php (article page). If your blog is normal, in your blog can appear in the Search engine page is basically the few, written as on the code, you can put these types of pages all do 301 new station Home page (also can be assigned to other pages).

After the completion of the engine you can search for the content of your old domain name, click to see the effect, is not already reached your new station? The only regret is: the original to find the article into the current home page, but also need to search your new site again to find the keyword you are in search engine really click on the article.

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.