lnmp 虚拟主机 子目录blog怎么实现伪静态(解决)
centos5.5 lnmp0.5 ./vhost 添加虚拟主机 绑定域名 www.a.com指定目录到/home/www/a//home/www/a/ 装了dedecmswww.a.com访问 /home/www/a/blog/ 下装了wordpresswww.a.com/blog访问如何实现blog的伪静态?编辑了/usr/local/nginx/conf/vhost/www.a.com.confserver { listen 80; server_name www.025buyi.com 025buyi.com *.025buyi.com; index index.html index.htm index.php default.html default.htm default.php; root/home/www/www.025buyi.com; include a.conf; location ~ .*\.(php|php5)?$ { fastcgi_passunix:/tmp/php-cgi.sock; fastcgi_index index.php; include fcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log off; }再修改/usr/local/nginx/conf/a.conflocation /blog/ {if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; }if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; }if (!-f $request_filename){ rewrite (.*) /index.php; }}以上修改方式结果不成功,wordpress 下无法实现固定链接。 请高人们指点指点[ 本帖最后由 Bigcar 于 2010-10-24 11:51 编辑 ] 问题解决
location /blog/ {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /blog/index.php;
}
}
前后都得指定目录/blog/ 可以直接调用wordpress的伪静态配置文件 弄这个可长时间了.郁闷死了.网上说的都不对,都是胡乱加二级目录,下面的才是对的.blog 要加对地方才是.
location /blog/ {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /blog/index.php;
}
} 不知道 我晕了啊啊啊啊啊啊啊啊 楼主,我真F了你,你分个行不行啊,看的我眼都花了 谢楼主,我又学了一招。
页:
[1]