#必写
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#隐藏url中的index.php,如果您的不是index.php,把此文件名改为您的文件名即可
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
#列表URL伪静态
RewriteRule ^list-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=lists&catid=$1&page=$2
#详情URL伪静态
RewriteRule ^content-([0-9]+)-([0-9]+)-([0-9]+).html index.php?m=content&c=index&a=show&catid=$1&id=$2&page=$3
#定义异常页面或者指定特定情况下中转的页面,错误代码直接百度上找
ErrorDocument 400 http://www.sindsun.com/
#WWW域名重定向
RewriteRule ^(.*) http://www.sindsun.com/$1 [R=301,L]
#网页重定向,Redirect permanent 原地址 新地址
Redirect permanent http://www.sindsun.com/a.html http://www.sindsun.com/b.html
#访问权限控制
order deny,allow
#允许访问的路径
allow from d:\\test\
#禁止访问的路径
deny from d:\\nos\
#设置图片防盗链
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
#允许访问的域名
RewriteCond %{HTTP_REFERER} !^http://(www\.)?http://www.sindsun.com/(/)?.*$ [NC]
#将非法盗链的图片替换的资源
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://www.sindsun.com/ [R,NC,L]
如果您的PHP运行环境是高版本的IIS,则需要配置web.config文件,在中间添加rewrite节点:
源文出处:狂码一生