因为我对< code>htacess不熟悉,所以我在这里生成了< code>htacess文件,下面是我的代码
Order allow,deny
<Files .htaccess .htpasswd .htuser .htgroups >
order allow,deny
deny from all
</Files>
<IfModule !mod_ssl.c>
Redirect permanent / https://www.domain.com/
</IfModule>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ - [F]
RewriteCond %{HTTP_USER_AGENT} Wget [OR]
RewriteCond %{HTTP_USER_AGENT} CherryPickerSE [OR]
RewriteCond %{HTTP_USER_AGENT} CherryPickerElite [OR]
RewriteCond %{HTTP_USER_AGENT} EmailCollector [OR]
RewriteCond %{HTTP_USER_AGENT} EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ExtractorPro
RewriteRule ^.*$ deny.html [L]
ErrorDocument 400 400.php
ErrorDocument 401 401.php
ErrorDocument 403 403.php
ErrorDocument 404 404.php
ErrorDocument 500 405.php
DirectoryIndex index.php
产生错误:
[Wed Jan 07 19:09:22.207084 2015] [core:alert] [pid 5032:tid 964] [client 200.195.156.150:43841] C:/wamp/www/.htaccess: Multiple <Files> arguments not (yet) supported.
当我
删除 mt htacess
文件并运行我的服务器时,甚至配置了以下方法mod_rewrite错误,我的索引页面打开,所有错误文档
页面以及 htacess
和索引页面都在根
文件夹中,任何人都可以帮助我出了什么问题
尝试使用FilesMatch而不是Files,我认为这是产生错误的部分。
<FilesMatch "\.(htaccess|htpasswd|htuser|htgroups)$">
Order Allow,Deny
Deny from all
</FilesMatch>
我保持代码的其余部分不变。
<IfModule !mod_ssl.c>
Redirect permanent / https://www.domain.com/
</IfModule>
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|png)$ - [F]
RewriteCond %{HTTP_USER_AGENT} Wget [OR]
RewriteCond %{HTTP_USER_AGENT} CherryPickerSE [OR]
RewriteCond %{HTTP_USER_AGENT} CherryPickerElite [OR]
RewriteCond %{HTTP_USER_AGENT} EmailCollector [OR]
RewriteCond %{HTTP_USER_AGENT} EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ExtractorPro
RewriteRule ^.*$ deny.html [L]
ErrorDocument 400 400.php
ErrorDocument 401 401.php
ErrorDocument 403 403.php
ErrorDocument 404 404.php
ErrorDocument 500 405.php
DirectoryIndex index.php
从.htaccess中删除所有代码,只保留以下代码。
RewriteEngine on
ErrorDocument 400 400.php
ErrorDocument 401 401.php
ErrorDocument 403 403.php
ErrorDocument 404 404.php
ErrorDocument 500 405.php
DirectoryIndex index.php