參考文章如下:
http://www.cnblogs.com/flymood/p/4868401.html
在ubuntu 下的設置方法爲:
用命令開啓僞靜態sudo a2enmod rewrite
service apache2 restart
然後在/etc/apache2/apache2.config中設置訪問的站點
1 2 3 4 5 6 7 8 9 |
|
service apache2 restart
2. 配置htaccess 文件
Apache是 Linux 主機下常見的環境,現在一般的 Linux 虛擬主機都採用這種環境。新建一個 htaccess.txt 文件,添加下面的代碼:
-
<IfModule mod_rewrite.c>
-
RewriteEngine On
-
RewriteBase /
-
RewriteRule ^index\.php$ - [L]
-
RewriteCond %{REQUEST_FILENAME} !-f
-
RewriteCond %{REQUEST_FILENAME} !-d
-
RewriteRule . /index.php [L]
-
</IfModule>
然後上傳到 WordPress 站點的根目錄,重命名爲 .htaccess 即可
(flymood: 我好像是直接自動生成的,沒有要手動添加)
3、重啓Apache
/etc/init.d/httpd restart
4、設置WordPress
系統運維 www.osyunwei.com 溫馨提醒:qihang01原創內容©版權所有,轉載請註明出處及原文鏈接
在WordPress後臺-設置-固定鏈接-自定義結構,輸入下面的代碼,最後保存更改即可。
/archives/%post_id%.html