wordpress 404 页面未找到永久链接 [英] wordpress 404 page not found permalinks

查看:48
本文介绍了wordpress 404 页面未找到永久链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的 wordpress 永久链接设置默认 http://localhost/mywebsite/?p=123 更改为 Post name http://localhost/mywebsite/sample-post/ .

i have change my wordpress Permalink Settings Default http://localhost/mywebsite/?p=123 to Post name http://localhost/mywebsite/sample-post/ .

然后我创建一个页面.它不工作.找不到 404 页面.

then i create a page. its not working. 404 page not found.

对此没有插件有任何解决方案.

谢谢

推荐答案

您可以检查 WordPress 主目录中是否存在 htaccess 文件,如上所示.如果没有创建一个:

You can check if there exist an htaccess file in your WordPress home directory as shown above. If it is not there create one:

$ sudo nano /var/www/html/.htaccess

然后复制粘贴下面的内容

and copy paste the below to it

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

按 ctrl+x 并按 y 保存文件.并通过

Press ctrl+x and press y to save the file. And restart apache by

$ sudo 服务 apache2 重启

$ sudo service apache2 restart

您想告诉 apache 跟随您的 .htaccess 文件.你可以通过编辑 apache.conf 文件来做到这一点

You would want to tell apache to follow your .htaccess file. You can do this by editing the apache.conf file

$sudo nano /etc/apache2/apache.conf

向下滚动到该行默认为:

Scroll down to the line By default it will be:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

将 AllowOverride 的值更改为 All 现在变成:

change the value of AllowOverride to All so now it becomes:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

按 ctrl+x 并按 y 保存配置文件.为了对服务器进行此更改,首先启用 mod_rewrite by.

Press ctrl+x and press y to save the configuration file. In order to make this changes to server first enable the mod_rewrite by.

$ sudo a2enmod rewrite

然后重启服务器

$ sudo service apache2 restart

完成!

来源:https://www.wst.space/谜语-wordpress-permalink-setup-issues/

这篇关于wordpress 404 页面未找到永久链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆