【问题标题】:Permalinks in Wordpress - 404 Page not found - Raspberry Pi serverWordpress 中的永久链接 - 找不到 404 页面 - Raspberry Pi 服务器
【发布时间】:2016-12-09 13:21:18
【问题描述】:

我知道这个问题被问了很多,但我已经尝试了很多东西,但都没有奏效。当我访问具有非默认永久链接的页面时,我收到 404 Page not found 错误。做了一些研究,我发现这也可能是服务器的问题,这就是为什么我提到我使用安装了 Raspian 的 Raspberry Pi 作为服务器的原因。我正在使用 Apache

我已经尝试过的事情:

我已经尝试过此处显示的解决方案:https://wordpress.org/support/topic/how-to-fix-permalink-postname-404-not-found,以及此处:Permalinks in Wordpress - Page not found。和其他网站

  • 我试过那个说更新/etc/apache2/sites-available/default,但我没有那个文件

  • 转到 /etc/httpd/conf 并编辑 httpd.conf,但我的服务器中也没有该文件

  • 确保您的服务器能够写入 .htaccess 文件。是的,我已经确定了这一点,但仍然没有

  • 更改您的 .htaccess 文件,将以下内容添加到文件顶部: Options +FollowSymlinks。我这样做了,但没有用

  • 通过键入(您需要是 root)a2enmod rewrite 启用 rewrite_mod。开启了,还是报错

  • /etc/init.d/apache2 restart 重启 apache。我什至重启了我的服务器,什么也没有

如有任何想法,我将不胜感激,在此先感谢

更新:

  • 我忘了说当我使用个性化结构时:/index.php/%postname%/ 它可以工作,但这种结构在我的网站中会有点奇怪

【问题讨论】:

    标签: wordpress server raspberry-pi http-status-code-404


    【解决方案1】:

    我修好了,解决办法如下:

    首先选择您希望的永久链接的结构。然后在你的树莓派服务器中:

    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
    

    它应该可以工作

    【讨论】:

    • 即使不更改目录 /(第一个)的 AllowOverride,它也对我有用
    猜你喜欢
    • 1970-01-01
    • 2016-07-19
    • 2012-09-06
    • 2016-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-11
    • 1970-01-01
    相关资源
    最近更新 更多