我有两个htaccess规则,我想转移到httpd.conf,因为我听说这是更好的性能。 我试着把它们复制到httpd.conf中,但是它没有使用相同的语法,因为它不起作用。 有人可以告诉我这两个.htaccess规则的httpd.conf相当于:
# DISABLE HOTLINKING RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/.*$ [NC] RewriteRule \.(gif|jpg|jpeg|png|js)$ - [F] # PREVENT ALL ACCESS TO THIS FILE <files admin.php> order allow,deny deny from all </files>
非常感谢。
只是把它们放在原处。
.htaccess恰恰是该目录的httpd.conf。 如果你只想限制到那个目录,就把它放在里面就可以了:
<Directory /path/to/your/directory> # DISABLE HOTLINKING RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/.*$ [NC] RewriteRule \.(gif|jpg|jpeg|png|js)$ - [F] # PREVENT ALL ACCESS TO THIS FILE <files admin.php> order allow,deny deny from all </files> </Directory>
把configuration规则放在httpd.conf里,对性能和.htaccess没有实际的影响,除非你有大量的。