Home > Topics > SEO > body text

How to set up URL standardization for 301 redirection

anonymity
Release: 2019-05-27 09:28:21
Original
2054 people have browsed it

We often encounter this situation. When other websites link to your site, they will use the following link:
www.example.com
example.com/
www.example.com/index .html
example.com/index.php
This results in: the PR value of your site’s main domain name is scattered to several other URLs.

How to set up URL standardization for 301 redirectionIf you use 301 redirection to redirect the other three URLs to
www.example.com
PR will also be concentrated on the main domain name: www.example.com.

Specific method for 301 redirection:
Set the .htaccess file (only applicable to Linux systems and requires virtual host support.)
So that when accessing example.com/, it will automatically go to www .example.com
Write the following code in the .htaccess file.

RewriteEngine on
RewriteCond %{http_host} ^mydomain.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301 ]

Note: URL standardized 301 redirect (the above code) needs to be written before other URL-rewrite codes.

The above is the detailed content of How to set up URL standardization for 301 redirection. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
seo
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template