工具
WordPress .htaccess Generator
The rules WordPress needs, plus the hardening rules it does not ship with
在你的浏览器里运行。什么都不上传。
关于WordPress .htaccess Generator
Generate a WordPress .htaccess file: the default rewrite rules, forced HTTPS, www-to-apex redirects, wp-login brute-force blocking, XML-RPC blocking, and wp-config protection. Copy it out and paste it in.
FAQ
常见问题
为什么我自定义的 .htaccess 伪静态规则消失了?
因为它们放在了 “# BEGIN WordPress” 区块里面。每次你保存固定链接设置时,WordPress 都会重写它 BEGIN 和 END 标记之间的所有内容,悄悄删掉你在那里加的任何东西。自定义规则必须放在那个区块的上方。
屏蔽 xmlrpc.php 能阻止暴力破解攻击吗?
它关上了一扇门,但不是全部。攻击者仍然可以直接打 wp-login.php。如果你用到的东西都不需要它,那屏蔽是值得的——但要知道 WordPress 手机 App 和 Jetpack 都会用到它。
我的主机跑的是 nginx。.htaccess 还管用吗?
不管用。nginx 完全无视 .htaccess——这个文件放在那里什么也不干。很多托管型 WordPress 主机跑的是 nginx,所以如果你的规则看起来完全没生效,先弄清楚你实际用的是哪种服务器,再去调规则本身。