欢迎光临
我们一直在努力

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

如果你通过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) 打赏
未经允许不得转载:Ddmit » Vps搭建wordpress站点开启伪静态页面的方法

评论 抢沙发

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册