Posts Tagged ‘.htaccess’

4 04 2009

.htaccess设置指南

bigCat Posted in Linux - 0 Comment

http://corz.org/serv/tricks/htaccess2.php mod_rewrite 教程

.htaccess 会降低APACHE的性能,除非你对目录权限要求很高或需要做UrlRewrite,否则不推荐你使用.

如果你的服务器目录结构是这样:

/usr/corsak/wwwroot/www/maindir

如果Apache指令中开启了AllowOverride支持.htaccess文件,每访问一次会依次搜索:

/usr/corsak/wwwroot/www/maindir/.htaccess
/usr/corsak/wwwroot/www/.htaccess
/usr/corsak/wwwroot/.htaccess

下面是一份详细的文档,不知道哪年从哪找的。 Read the rest of this entry »

4 04 2009

.htaccess的防盗链

bigCat Posted in Linux - 0 Comment

1、
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://你的域名/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://你的域名$ [NC]
RewriteRule .*/.(jpg|jpeg|gif|png|bmp|rar|zip|exe)$ 盗链后转向的地址 [R,NC]

修改一下上面的代码,然后保存为.htaccess,并且上传到你空间上面要保护的目录下就可以了。

2、

把下面的语句存成一个.htaccess文件,并放到你的网站的根目录(就是www/html目录)

SetEnvIfNoCase Referer "^http://ioctech\.com/" local_ref=1

Order Allow,Deny
Allow from env=local_ref
Allow from 127.0.0.1

Host: (miao) | Word: Press | Code: bigCat | Valid: HTML5