在centos7下面安装了lnmp和wordpress,现在wordpress目录在网络的二级目录下,想显示为一级目录


我在自己的vps上安装了cent os7,然后安装了lnmp和wordpress,
wordpress安装在二级目录下,现在显示格式为 http:// 我的网址/wordpress
我希望显示的格式是 http:// 我的网址。

发现安装wordpress之后,wordpress目录下没有.htaccess文件,用ls -al也看不到,
应该是没有的。可能apache才有.htaccess文件。

按照网上的方法,我把index.php文件从wordpress目录下拷贝到了网址目录下,把该文件内的
'/wp-blog-header.php'改成了'/wordpress/wp-blog-header.php'

另外在/usr/local/nginx/conf/vhost/我的网址.conf里include了
/usr/local/nginx/conf/wordpress.conf文件,而在wordpress.conf里的语句是

location / {
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内容,望指教,多谢!

php wordpress nginx lnmp centos

你把root目录换成你的二级目录不就行了么

く鹰仓杏璃 answered 9 years ago

Your Answer