Welcome to Snooda's Blog
						
					wordpress在nginx中的rewrite重写规则
		[ |
|  2012/05/27 12:02]
 2012/05/27 12:02]
		
	 |
|  2012/05/27 12:02]
 2012/05/27 12:02]
		
	    对于wordpress开启静态化url时如何在nginx下配置重写rewrite规则,网上一大抄的一个方式是说这样配置:
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
看起来没什么错误,但实际使用中总发现静态文件也被rewrite走了,去nginx官网发现有了新参数:
在location /段里加上一句:try_files $uri $uri/ /index.php?q=$uri&$args;
ok了,轻松愉快。
	
	
	
	
	
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
看起来没什么错误,但实际使用中总发现静态文件也被rewrite走了,去nginx官网发现有了新参数:
在location /段里加上一句:try_files $uri $uri/ /index.php?q=$uri&$args;
ok了,轻松愉快。


 

