Vps搭建wordpress站点开启伪静态页面的方法

洼地云 tuoyidashi.png

如果你通过vps搭建wordpress站点后发现除了首页之外,各个伪静态链接的页面、分类页面、标签页面都显示404,那就是你没有成功开启伪静态页面的原因。

搭建wordpress站点,一般分为两类情况,服务器是Apache或者Nginx。

如果是Apache,那么开启伪静态页面,一般需要在网站根目录,添加.htaccess文件,内容大概如下:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

如果是Nginx,那么就需要通过修改nginx.conf文件来实现了,具体如下:

location / {
           root   html;
           index  index.php index.html index.htm;
           try_files $uri $uri/ /index.php?$args;  #修改内容
 }

参考文章:

1.https://wordpress.org/support/topic/permalinks-error-404-not-found-running-on-nginx;

赞(0)
未经允许禁止转载:优米格 » Vps搭建wordpress站点开启伪静态页面的方法

评论 抢沙发

合作&反馈&投稿

商务合作、问题反馈、投稿,欢迎联系

广告合作侵权联系

登录

找回密码

注册