Wordpress 如何仅针对某些文件类型/扩展名发布410头(gone)
短篇故事:黑客用一些奇怪的扩展(如drf)增加了一百万页 现在,我想通过htaccess发布410头文件。这是我到目前为止所做的,但没有工作:Wordpress 如何仅针对某些文件类型/扩展名发布410头(gone),wordpress,apache,.htaccess,header,http-headers,Wordpress,Apache,.htaccess,Header,Http Headers,短篇故事:黑客用一些奇怪的扩展(如drf)增加了一百万页 现在,我想通过htaccess发布410头文件。这是我到目前为止所做的,但没有工作: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !\.dfr$ Rewrit
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.dfr$
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RewriteRule ^.*\.dfr$ - [R=410]
# Not sure if I really need this, but whatever
ErrorDocument 404 default
重新编写引擎打开
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写条件%{REQUEST\u URI}!\。dfr美元
重写规则/index.php[L]
#结束WordPress
重写规则^.*\.dfr$-[R=410]
#不确定我是否真的需要这个,但不管怎样
错误文档404默认值
有了这个,我仍然得到了WordPress404页面,所以很明显有些东西遗漏/错误
更新: 我试过这个。同样的结果(WordPress404)。还有一些缓存规则,来自一个流行的插件,但没有把它们放在那里
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
ErrorDocument 404 default
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule \.dfr$ - [NC,G,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
重新编写引擎打开
重写条件%{HTTPS}关闭
重写条件%{REQUEST\u URI}!^/\。著名的/acme挑战赛/[0-9a-zA-Z_-]+$
重写条件%{REQUEST\u URI}!^/\。著名的/cpanel dcv/[0-9a-zA-Z_-]+$
重写条件%{REQUEST\u URI}!^/\。众所周知的/pki验证/[A-F0-9]{32}\.txt(?:\comdo\DCV)$
重写规则^(.*)$https://%{HTTP_HOST}%{REQUEST_URI}[L,R=301]
错误文档404默认值
#开始WordPress
重新启动发动机
重写基/
重写规则\.dfr$-[NC,G,L]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
在RewriteBase
行下方添加此规则:
RewriteRule \.dfr$ - [NC,G,L]
您还可以使用标志
[NC,F]
返回更合适的403
(禁止)。未修复。仍然可以看到wordpress页面及其404状态。您是否将此规则放置在顶部RewriteBase/
行下方?如果是,则可能是由于某些Wordpress缓存/代理插件覆盖了htaccess