前提:环境架构是以apache为web,并且支持.htaccess 1、实现pw伪
静态(需要mod_rewrite模块)
写个 .htaccess 内容是
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase / //这个地方按照实际作用目录而定 "/"代表
网站的根目录
RewriteRule ^(.*)-htm-(.*)$ $1.php?$2
RewriteRule ^(.*)/simple/([a-z0-9\_]+\.html)$ $1/simple/index.php?$2
</IfModule>
上传到web的根目录
2、自定义404错误页面
写个 .htaccess 内容是
ErrorDocument 404 /error.html /定义错误的页面
上传到web的根目录
3、防盗链的设置(需要mod_rewrite模块)
写个 .htaccess 内容是
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^
http://XXX.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^
http://XXX.com$ [NC]
RewriteCond %{HTTP_REFERER} !^
http://www.XXX.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^
http://www.XXX.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
注意XXX.com为您自己的
域名 上传到web的根目录
4、
修改默认
首页文件
写个 .htaccess 内容是上传到web的根目录
DirectoryIndex index.shtml index.html //此处把需要添加的首页文件放到第一位
5、防止目录列表时显示
写个 .htaccess 内容是
IndexIgnore *
上传到web的根目录
待续的。。。
[ 此贴被小猴在2007-12-26 23:22重新编辑 ]