从A到Z!26个用于 Wordpress 的 .htaccess 规则
作者: ligyxy | 分类: 博客技巧 | 时间: 2009-07-25
标签:blogging, SEO, share, WordPress
17
我们知道 .htaccess 文件能轻松地强化你的博客,减少带宽并增加可用性。我曾经写过一篇简易的 .htaccess 教程:《四个例子实战讲解.htaccess文件rewrite规则》。如果你还想继续了解 .htaccess 文件,那么不妨看看下面这26个规则:
但是请先记住一条黄金法则:
先备份,再折腾!
A – WP- Admin – 管理员页面
你可以限制访问 WP- Admin 页面的 IP 地址
1 2 3 | order deny,allow allow from a.b.c.d # This is your static IP deny from all |
来源 -BlogSecurity.net
B – Blacklist – 黑名单
.htaccess 的一个重要功能是你能把它作为 IP 黑名单来使用:
1 2 3 4 5 | <limit GET POST PUT> order allow,deny allow from all deny from 123.456.789 </limit> |
来源 – Perishable Press
C – WP-Config Protection – 保护 Config 页
WP-Config 文件里包含了你的数据库名、数据库用户名与密码。这样的文件你敢让别人看到吗?所以你会需要用 .htaccess 来保护它。
1 2 3 4 5 | # protect wpconfig.php <files wp-config.php> order allow,deny deny from all </files> |
来源 – Josiah Cole




