PHP开发笔记's Archiver

fangzhen 发表于 2010-12-9 13:21

.htaccess For DiscuzX 加强版【含防盗链(支持泛域名)和www301 URL静态跳转】

<P># 将 RewriteEngine 模式打开<BR>RewriteEngine On</P>
<P>#防盗链开启,支持泛域名<BR>RewriteCond %{HTTP_REFERER} !^http://phpvi.com.*$&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [NC]<BR>RewriteCond %{HTTP_REFERER} !^http(s)?://(.)+\.phpvi\.com [NC]<BR>RewriteRule .*\.(gif|GIF|jpg|JPG|mpg|MPG|mpeg|MPEG|wmv|WMV|rm|RM|zip|ZIP|rar|RAR|js|JS|css|CSS|txt|TXT)$ <A href="http://www.phpvi.com/arc/404.gif">http://www.phpvi.com/arc/404.gif</A> [NC,R,L]</P>
<P>DirectoryIndex index.php index.html index.htm<BR>#让指定域名访问指定根目录(独立IP服务器)<BR>RewriteCond %{HTTP_HOST} ^www.phpvi.com$<BR>RewriteCond %{REQUEST_URI} !^/<BR>RewriteCond %{REQUEST_FILENAME} !-f<BR>RewriteCond %{REQUEST_FILENAME} !-d<BR>RewriteRule ^(.*)$ /$1<BR>RewriteCond %{HTTP_HOST} ^www.phpvi.com$<BR>RewriteRule ^(/)?$ arc/index.php [L]</P>
<P># 修改以下语句中的 /discuz 为你的论坛目录地址,如果程序放在根目录中,请将 /discuz 修改为 /<BR>RewriteBase /</P>
<P># Rewrite 系?规则请勿修改<BR># url canonicalization www 301 URL 静态跳转<BR>RewriteCond %{http_host} ^phpvi.com[NC]<BR>RewriteRule ^(.*)$ <A href="http://www.phpvi.com/$1">http://www.phpvi.com/$1</A> [L,R=301]</P>
<P>RewriteCond %{QUERY_STRING} ^(.*)$<BR>RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&amp;topic=$1&amp;%1<BR>RewriteCond %{QUERY_STRING} ^(.*)$<BR>RewriteRule ^article-([0-9]+)\.html$ portal.php?mod=view&amp;aid=$1&amp;%1<BR>RewriteCond %{QUERY_STRING} ^(.*)$<BR>RewriteRule ^forum-([0-9]+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&amp;fid=$1&amp;page=$2&amp;%1<BR>RewriteCond %{QUERY_STRING} ^(.*)$<BR>RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&amp;tid=$1&amp;extra=page\%3D$3&amp;page=$2&amp;%1<BR>RewriteCond %{QUERY_STRING} ^(.*)$<BR>RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&amp;fid=$1&amp;page=$2&amp;%1<BR>RewriteCond %{QUERY_STRING} ^(.*)$<BR>RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&amp;$1=$2&amp;%1<BR>RewriteCond %{QUERY_STRING} ^(.*)$<BR>RewriteRule ^([a-z]+)-(.+)\.html$ $1.php?rewrite=$2&amp;%1</P>

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.