简体   繁体   English

将.htaccess更改为禁止垃圾邮件链接

[英]Change .htaccess to forbid spam links

My site got hacked and a bunch of links in a spammer-created /up sub-directory are getting a lot of hits. 我的网站被黑了,垃圾邮件发送者创建的/up子目录中的许多链接都受到了很大的欢迎。

I have cleared out the mess (a .htaccess rewrite and a wp-stat.php file, and now I would like to ignore/forbid all requests to the /up directory. 我已经清除了混乱( .htaccess重写和wp-stat.php文件,现在我想忽略/禁止对/up目录的所有请求。

Currently I have a simple wordpress created .htaccess, but can't find a way of trapping requests to /up before the rewrite rules take over and give a 404 page from my wordpress theme. 目前,我有一个简单的wordpress创建的.htaccess文件,但是在重写规则接管并通过我的wordpress主题提供404页之前,无法找到将请求捕获到/up的方法。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

You can replace your current code by this one 您可以用此代码替换当前代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} ^/up(/.*|$) [NC]
RewriteRule ^ - [F]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>

This will forbid all /up urls 这将禁止所有/up网址

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM