2016-08-03 102 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

如果您的問題得到解決,然後接受你的答案 –