Board logo

标题: .htaccess For DiscuzX 加强版【含防盗链(支持泛域名)和www301 URL静态跳转】 [打印本页]

作者: fangzhen    时间: 2010-12-9 13:21     标题: .htaccess For DiscuzX 加强版【含防盗链(支持泛域名)和www301 URL静态跳转】

# 将 RewriteEngine 模式打开
RewriteEngine On

#防盗链开启,支持泛域名
RewriteCond %{HTTP_REFERER} !^http://phpvi.com.*$       [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(.)+\.phpvi\.com [NC]
RewriteRule .*\.(gif|GIF|jpg|JPG|mpg|MPG|mpeg|MPEG|wmv|WMV|rm|RM|zip|ZIP|rar|RAR|js|JS|css|CSS|txt|TXT)$ http://www.phpvi.com/arc/404.gif [NC,R,L]

DirectoryIndex index.php index.html index.htm
#让指定域名访问指定根目录(独立IP服务器)
RewriteCond %{HTTP_HOST} ^www.phpvi.com$
RewriteCond %{REQUEST_URI} !^/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /$1
RewriteCond %{HTTP_HOST} ^www.phpvi.com$
RewriteRule ^(/)?$ arc/index.php [L]

# 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /
RewriteBase /

# Rewrite 系?规则请勿修改
# url canonicalization www 301 URL 静态跳转
RewriteCond %{http_host} ^phpvi.com[NC]
RewriteRule ^(.*)$ http://www.phpvi.com/$1 [L,R=301]

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)\.html$ portal.php?mod=view&aid=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2&%1






欢迎光临 PHP开发笔记 (http://phpvi.com/) Powered by Discuz! 6.1.0