由于我是htacess
的新用户所以我生成了htacess
档here而下面是我的代码
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.
并且错误mod_rewrite
甚至已配置following method
当我删除mt htacess
文件并运行我的服务器时我的索引页打开,所有ErrorDocument
页面和htacess
和索引页面都在root
文件夹中可以任意一个帮帮我什么错误
答案 0 :(得分:0)
尝试使用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
答案 1 :(得分:-1)
从.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