[英]only default permalinks working wordpress others become 404 error
[英]wordpress apache permalinks not working (404 error)
我已經安裝在我的 apache2 服務器 wordpress 站點上,但所有永久鏈接都不起作用(找不到 404)我的 .htaccess 是由 wp 生成的
# 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
我的這個站點的 conf 文件:
<Directory /home/sergey/siteName>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
謝謝。
更新:
感謝 Justin Iurman 的評論。 在我的 conf 中設置 AllowOverride All 解決了問題:)
如何讓 WordPress 永久鏈接/漂亮的鏈接在 Ubuntu 10.10 和 Apache2 中工作:
順便說一下,這在 Ubuntu 10.04 中也應該是一樣的,但我也沒有在那里實際測試過。
手動創建一個“.htaccess”文件並將其保存在您的主 WordPress 目錄中。 (這是帶有 wp-admin、wp-includes 和 wp-content 文件夾的文件夾。)
轉到 Ubuntu 終端並輸入:
須藤 chown -v :www-data "/enterYourFilePathHere/.htaccess"
您應該會看到打印的一行說明(組)文件所有權已更改為 www-data (Apache2)。
sudo chmod -v 664 "/enterYourFilePathHere/.htaccess"
您應該會看到一行打印出來,表示文件的模式已被保留。
須藤 a2enmod 重寫
您應該會看到一行打印出來,說它正在啟用 mod rewrite 並提醒您重新啟動 Web 服務器
須藤 /etc/init.d/apache2 重啟
我們都完成了命令行提示符; 您現在可以關閉命令行窗口。
進入您的 WordPress 管理面板(即http://yourDomain/wp-admin )。 轉到設置 --> 永久鏈接並選擇您選擇的永久鏈接格式。 點擊“保存更改”按鈕。
完畢! 轉到您的站點並檢查任何頁面(除了您的主頁)以確定一切都按預期工作。
希望這可以幫助某人。
按照 nmk 編寫的步驟操作后,
須藤vim /etc/apache2/apache2.conf
查找條目<Directory /var/www/html>
和改變AllowOverride None
到AllowOverride All
然后保存文件(:wq)並在命令提示符下重新啟動 apache2 服務
須藤 /etc/init.d/apache2 重啟
<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
3.激活mod_rewrite
sudo a2enmod rewrite
4.重新啟動apache服務器以使此更改生效。
sudo apachectl restart
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.