2011年8月

转自:Nginx支持WordPress3.0.1的永久链接(Permalink)

我最近准备使用Nginx+php-fpm搭建WordPress平台。

安装完成后准备启用友好形式的永久链接,但是经过种种尝试和查资料后,都不能成功。

Nginx没有Apache特有的mod_rewrite,因此不能由WordPress自动配置。

查资料时发现网上流传广泛的解决方案都不管用。

下面给出我的解决方案。

首先参照Apache2的.htaccess文件:

[code toolbar="true"]
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
[/code]

翻译成Nginx的rewrite规则如下:

[code toolbar="true"]
location /wordpress/ {
rewrite ^index\.php$ - last;

if ( !-e $request_filename ) {
rewrite . /wordpress/index.php last;
}
}
[/code]

已经经过实践验证了。:-)

作为一个普普通通的程序员,我曾经多次想做一个博客,分享一下生活与工作中碰到的问题、有意思的文章等等,但由于精力与毅力的问题,始终没有开始写博客

为了记录一下自己的技术经历,我终于决定要开始写一个属于自己的博客

一切从最简单的开始吧。。。