最近有一位客戶因為使用WordPress 時提問,採用我們的主機是否沒有辦法rewrite?
是的,我們的server 2003 R2 是IIS6,的確沒有內建此模組。
那怎麼辦呢,其實第三方有提供許多可自行擴充的模組可以自行擴充。
本站採用helicon tech出品的ISAPI rewrite解決這個問題,
這樣在IIS 6就可以將URL rewirte,
並使用.htaccess來設定各目錄及檔案的操作方式了。

================================================
.htaccess放置,wordpress的偽靜態寫法參考
# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress


.htaccess 語法簡介可以參考以下這篇:
http://readily-notes.blogspot.tw/2011/11/url-rewrite.html

這裡有一篇,參考wordpress若不使用上述模組,且達到rewrite的方法:
http://blog.lansea-chu.com/index.php/archives/263

=====================================================
先設定 WordPress ,進入後台選擇想要的固定網址格式,
如「/%year%/%monthnum%/%day%/%postname%.html」,記得把前面 index.php 拿掉。
我們用以下這樣的格式:
/%year%/
%monthnum%/%day%/%postname%/


但這種格式有個缺點 就是萬一您的標題是有『非英文』的字 那就無法正常使用,解決方式則改用以下
/%year%/%monthnum%/%day%/%post_id%.html   (有html後綴) 
或者

/%year%/%monthnum%/%day%/%post_id%
(沒有html後綴) 如此即可使用固定網址(改採模擬靜態化)

arrow
arrow
    全站熱搜

    NetPC虛擬主機 發表在 痞客邦 留言(0) 人氣()