2016-08-03 110 views
0

我知道这个问题已经被问了很多,但我已经尝试了很多东西,但都没有工作。我收到一个404页面未找到错误,当我访问的网页与永久以外的默认。做一些研究,我发现它也可能是服务器的问题,这就是为什么我提到我使用安装Raspian作为服务器的Raspberry Pi。我使用的ApacheWordpress中的固定链接 - 404页未找到 - Raspberry Pi服务器

事情我已经尝试:

我已经试过这里显示的解决方案: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。我这样做,并没有奏效

  • 通过键入以下命令启用rewrite_mod(你需要root权限)a2enmod rewrite。它已启用,但仍然有错误的/etc/init.d/apache2 restart

  • 重新启动Apache。我甚至重新启动我的服务器并没有什么

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

更新:

  • 我忘了说,当我使用个性化结构:/index.php/%postname%/它的工作原理,但是这个结构在我的网站上会有点奇怪

回答

0

我修好了,这里是解决方案:

首先选择你想要的永久链接的结构。然后在你的raspberrry PI服务器:

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 

,它应该是工作

+0

如果您的问题得到解决,然后接受你的答案 –