A-A+
wordpress apache和IIS环境下伪静态规则
在本地测试 wordpress 博客系统,如果在后台进行固定链接的更改,是会自动生成伪静态规则的,最近新开了一个 win 的虚拟主机,上传了 wordpress 后居然没有自动生成伪静态的规则,导致文章的链接出现无法打开的现象,没办法,只能手动建立一下伪静态规则的文件了,下面夏日博客就为大家讲一下 wordpress 分别在 apache 和 IIS 环境下伪静态规则是如何建立的。
apache 环境下的 wordpress 伪静态规则代码如下:
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]
将本代码保存为 .htaccess 文件并上传到站点的根目录下即可实现 wordpress 伪静态。
IIS 环境下的 wordpress 伪静态规则代码如下:
[ISAPI_Rewrite] # Defend your computer from some worm attacks #RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O] # 3600 = 1 hour CacheClockRate 3600 RepeatLimit 32 # Protect httpd.ini and httpd.parse.errors files # from accessing through HTTP # Rules to ensure that normal content gets through RewriteRule ^/$ /index.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule /(.*) /index.php/$1 [L]
将本代码保存为 httpd.ini 的文件并上传到站点的根目录下即可。