Wordpress 中的永久链接 - 找不到 404 页面 - Raspberry Pi 服务器
Permalinks in Wordpress - 404 Page not found - Raspberry Pi server
我知道这个问题已经被问了很多,但我已经尝试了很多东西,其中 none 有效。当我访问具有非默认永久链接的页面时,出现 404 未找到页面 错误。通过一些研究,我发现这也可能是服务器的问题,这就是为什么我提到我使用 Raspberry Pi 并安装了 Raspian 作为服务器的原因。我正在使用 Apache
我已经尝试过的事情:
我已经尝试过此处显示的解决方案:https://wordpress.org/support/topic/how-to-fix-permalink-postname-404-not-found, and here: Permalinks in Wordpress - Page not found。在其他网站
我尝试了 更新 /etc/apache2/sites-available/default
,但我没有那个文件
转到 /etc/httpd/conf 并编辑 httpd.conf 但我没有该文件在我的服务器中
确保你的服务器能够写入 .htaccess 文件。 是的,我已经确信这一点,但仍然一无所获
更改您的 .htaccess 文件,将以下内容添加到文件顶部:
Options +FollowSymlinks
。我这样做了,但没有用
通过键入启用 rewrite_mod(您需要是 root)a2enmod rewrite
.已启用,但仍然报错
按/etc/init.d/apache2 restart
重启apache。我什至重新启动了我的服务器,什么也没有
拜托,如果有任何想法,我将不胜感激,在此先感谢
更新:
- 我忘了说,当我使用个性化结构时:
/index.php/%postname%/
可以,但我的网站上的结构会有点奇怪
我解决了,这里是解决方案:
首先选择您想要的固定链接结构。然后在你的树莓派服务器中:
sudo a2enmod rewrite
sudo service apache2 restart
然后
sudo nano /etc/apache2/apache2.conf
并更改此:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
为此:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
重新启动 apache2 服务器
sudo service apache2 restart
它应该可以正常工作
我知道这个问题已经被问了很多,但我已经尝试了很多东西,其中 none 有效。当我访问具有非默认永久链接的页面时,出现 404 未找到页面 错误。通过一些研究,我发现这也可能是服务器的问题,这就是为什么我提到我使用 Raspberry Pi 并安装了 Raspian 作为服务器的原因。我正在使用 Apache
我已经尝试过的事情:
我已经尝试过此处显示的解决方案:https://wordpress.org/support/topic/how-to-fix-permalink-postname-404-not-found, and here: Permalinks in Wordpress - Page not found。在其他网站
我尝试了 更新
/etc/apache2/sites-available/default
,但我没有那个文件转到 /etc/httpd/conf 并编辑 httpd.conf 但我没有该文件在我的服务器中
确保你的服务器能够写入 .htaccess 文件。 是的,我已经确信这一点,但仍然一无所获
更改您的 .htaccess 文件,将以下内容添加到文件顶部:
Options +FollowSymlinks
。我这样做了,但没有用通过键入启用 rewrite_mod(您需要是 root)
a2enmod rewrite
.已启用,但仍然报错按
/etc/init.d/apache2 restart
重启apache。我什至重新启动了我的服务器,什么也没有
拜托,如果有任何想法,我将不胜感激,在此先感谢
更新:
- 我忘了说,当我使用个性化结构时:
/index.php/%postname%/
可以,但我的网站上的结构会有点奇怪
我解决了,这里是解决方案:
首先选择您想要的固定链接结构。然后在你的树莓派服务器中:
sudo a2enmod rewrite
sudo service apache2 restart
然后
sudo nano /etc/apache2/apache2.conf
并更改此:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
为此:
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
重新启动 apache2 服务器
sudo service apache2 restart
它应该可以正常工作