一、下载ISAPI_REWRITE并安装
二、修改httpd.ini
RewriteCond Host: (img\.abc\.cn)
RewriteCond Referer: (?!http://\1.*).*
RewriteCond Referer: (?!http://(?:.*\.baidu\.com|baidu\.com|.*
\.google\.net|google\.net|.*\.sohu\.com|sohu\.com)).+
RewriteRule .*\.(?:jpg|gif|bmp) /block.gif [I,O,N]
三、上传/block.gif文件到在虚拟主机img.abc.cn站点根目录下.
四、在IIS中修改?block.gif属性->http头->启用内容失效->立即过期
五、重启IIS完毕。
注:当从限制访问到允许访问,发现在IE下可以立即过期,firefox就不行。
二、修改httpd.ini
引用
RewriteCond Host: (img\.abc\.cn)
RewriteCond Referer: (?!http://\1.*).*
RewriteCond Referer: (?!http://(?:.*\.baidu\.com|baidu\.com|.*
\.google\.net|google\.net|.*\.sohu\.com|sohu\.com)).+
RewriteRule .*\.(?:jpg|gif|bmp) /block.gif [I,O,N]
三、上传/block.gif文件到在虚拟主机img.abc.cn站点根目录下.
四、在IIS中修改?block.gif属性->http头->启用内容失效->立即过期
五、重启IIS完毕。
注:当从限制访问到允许访问,发现在IE下可以立即过期,firefox就不行。
第一步,修改httpd.conf
修改成:
作用是开启.htaccess功能。
在站点目录下新建.htaccess文件(window下不能直接创建,得先在记事本编辑好再保存为.htaccess)
方案一
RewriteEngine on
RewriteCond $1 !^(index\.php|public|tmp|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
方案二
RewriteEngine on
RewriteOptions Inherit
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]
重启apache搞定。
修改成:
作用是开启.htaccess功能。
在站点目录下新建.htaccess文件(window下不能直接创建,得先在记事本编辑好再保存为.htaccess)
方案一
引用
RewriteEngine on
RewriteCond $1 !^(index\.php|public|tmp|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
方案二
引用
RewriteEngine on
RewriteOptions Inherit
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php/$1 [L]
重启apache搞定。