网站优化_企业网站优化_网站优化服务

当前位置: 网站优化 > seo分享 >

htaccess.txt

时间:2010-08-04 16:09来源:未知 作者:admin 点击:
htaccess常用命令

##

# 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 404页面怎么做
ErrorDocument 404 /404.html

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

 

(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片