ubuntu 開啓僞靜態

參考文章如下:

 

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

<Directory /home/iat/workspace/PHPsite>

 

Options Indexes FollowSymLinks

 

AllowOverride ALL

 

Require all granted

 

</Directory>

service apache2 restart

 

2. 配置htaccess 文件

Apache是 Linux 主機下常見的環境,現在一般的 Linux 虛擬主機都採用這種環境。新建一個 htaccess.txt 文件,添加下面的代碼:

  1. <IfModule mod_rewrite.c>
  2. RewriteEngine On
  3. RewriteBase /
  4. RewriteRule ^index\.php$ - [L]
  5. RewriteCond %{REQUEST_FILENAME} !-f
  6. RewriteCond %{REQUEST_FILENAME} !-d
  7. RewriteRule . /index.php [L]
  8. </IfModule>

然後上傳到 WordPress 站點的根目錄,重命名爲 .htaccess 即可

(flymood: 我好像是直接自動生成的,沒有要手動添加)

 

3、重啓Apache
/etc/init.d/httpd restart
    
4、設置WordPress
系統運維  www.osyunwei.com  溫馨提醒:qihang01原創內容©版權所有,轉載請註明出處及原文鏈接

在WordPress後臺-設置-固定鏈接-自定義結構,輸入下面的代碼,最後保存更改即可。        
/archives/%post_id%.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章