百谷虎网站优化管理顾问

linux系统301重定向怎么进行URL标准化设置


Net Reprint 时间:2010-1-11 《linux系统301重定向怎么进行URL标准化设置》相关资讯 拷贝《linux系统301重定向怎么进行URL标准化设置》的地址
http://www.bghseo.com BGHSEO网站优化管理顾问
搜索引擎优化的最高境界是忘记搜索引擎优化。

经常会碰到这样的情况,其他网站链接你的站点时,会用下面的链接:

www.example.com
example.com/
www.example.om/index.html
example.com/index.php

而这样导致:你站点主域名的pr值分散到其他几个URLs了。

如果你用301重定向把其他三个URL转到
www.example.com
PR也就集中在主域名:www.example.com 了。

301重定向具体办法:

设置.htaccess文件(只适用于linux系统,并需要虚拟主机支持。)

使访问example.com/的时候就会自动转到www.example.com
在.htaccess文件里写上以下代码即可。

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

了解本站的.htaceess文件设置,

##

# if you want to use mod_rewrite, set this ‘On‘
RewriteEngine On

# the path to your site installation
RewriteBase /

# Maintenance Section - Uncomment the lines below according to your need
# Write below your client IP address (e.g.: 127.0.0.1)
# if you need to keep your web access during maintenance
#RewriteCond %{REMOTE_ADDR}          !^127.0.0.1$
# Choose your way of closing the access to PMF:
# a. you can simply forbid access (HTTP 403 Error)
#RewriteRule ^(.*)$                  underMaintenance.htm [F,L]
# b. return the user an explanation
#RewriteRule ^(.*)$                  underMaintenance.htm [L]

# url canonicalization
RewriteCond %{http_host} ^seowhy.com [NC]
RewriteRule ^(.*)$ http://www.seowhy.com/$1 [L,R=301]

# show all categories
RewriteCond %{REQUEST_URI}          showcat\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=show [L,QSA]

# the search page
RewriteCond %{REQUEST_URI}          search\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=search [L,QSA]

# the add content page
RewriteCond %{REQUEST_URI}          addcontent\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=add [L,QSA]

# the ask question page
RewriteCond %{REQUEST_URI}          ask\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=ask [L,QSA]

# the open questions page
RewriteCond %{REQUEST_URI}          open\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=open [L,QSA]

# the help page
RewriteCond %{REQUEST_URI}          help\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=help [L,QSA]

# the contact page
RewriteCond %{REQUEST_URI}          contact\.html$ [NC]
RewriteRule ^(.*)$                  index.php?action=contact [L,QSA]

# a page with a record
RewriteCond %{REQUEST_URI}          ([0-9]+)_([0-9]+)_([a-z\-]+)\.html$ [NC]
RewriteRule ^(.*)_(.*)_(.*)\.html$  index.php?action=artikel&cat=$1&id=$2&artlang=$3 [L,QSA]

# a category page
RewriteCond %{REQUEST_URI}              category([0-9]+)\.html$ [NC]
RewriteRule ^category(.*)\.html$        index.php?action=show&cat=$1 [L,QSA]

# a category page with page count
RewriteCond %{REQUEST_URI}              category([0-9]+)_([0-9]+)\.html$ [NC]
RewriteRule ^category(.*)_(.*)\.html$   index.php?action=show&cat=$1&seite=$2 [L,QSA]

# start page
RewriteRule index.html$ index.php [PT]

# sitemap
RewriteCond %{REQUEST_URI}              sitemap-([a-zA-Z0-9漩周遌*)_([a-z\-]+)\.html$ [NC]
RewriteRule ^sitemap-(.*)_(.*)\.html$   index.php?action=sitemap&letter=$1&lang=$2 [L,QSA]

# a solution id page
RewriteCond %{REQUEST_URI}              solution_id_([0-9]+)\.html$ [NC]
RewriteRule ^solution_id_(.*)\.html$    index.php?solution_id=$1 [L,QSA]

# 404 page
ErrorDocument 404 /404.html


>>浏览更多"linux系统301重定向怎么进行URL标准化设置"相关信息,资讯网站排名,网站营销,Google推广,百度快照排名,企业网站推广网站优化服务,对网站营销分析,了解搜索引擎优化知识,SEO动态,SEO技术,SEO工具,网站漏洞等知识,请点击进入百谷虎网站优化管理顾问网站首页.

上一篇:搜索引擎优化的详细阐述
下一篇:增加反向链接的n个技巧

【关键词:linux系统301重定向怎么进行URL标准化设置】【已被关注过:次】
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码: