重寫URL我需要做的是從與htaccess的
www.mywebsite.com/index.php
www.mywebsite.com/index改變我的網站的鏈接中,例如。 PHP?行動= about_us
到
www.myswebsite.com/index.html
www.myswebsite.com/about_us.html
有人告訴我htaccess的來達致這,我想這與某種形式的正則表達式的實現。
我該如何達到這個結果?
重寫URL我需要做的是從與htaccess的
www.mywebsite.com/index.php
www.mywebsite.com/index改變我的網站的鏈接中,例如。 PHP?行動= about_us
到
www.myswebsite.com/index.html
www.myswebsite.com/about_us.html
有人告訴我htaccess的來達致這,我想這與某種形式的正則表達式的實現。
我該如何達到這個結果?
你有
www.mywebsite.com/index.php?action=about_us
,你想
www.myswebsite.com/about_us.html
在.htaccess
文件在該文件的末尾添加一行:
redirect /about_us http://www.myswebsite.com/about_us.html
瞧
http://affiliate-minder.com/internetmarketing/using-htaccess-file-for-affiliate-link-redirects/
PK
打開重寫引擎。當第一個參數被調用時,RewriteRule將在第二個參數中獲取頁面。因此www.myswebsite.com/about_us.html
將加載www.mywebsite.com/index.php?action=about_us
,但地址欄中的網址仍將爲www.myswebsite.com/about_us.html
。最後的[NC]
只是使其不區分大小寫。
RewriteEngine On
RewriteRule ^/about_us\.html$ index.php?action=about_us [NC]
更多信息: http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
CheckSpelling on
Options -Indexes
Options +FollowSymlinks
DirectoryIndex index.php
RewriteEngine on
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$\.html /index.php?action=$1 [L,QSA]
,並從那裏,你可以使用index.php
要麼導航,或者只是顯示的內容
那麼你可以通過標題我很沒有看到知道如何說出來,並找到我需要的...不用謝了你,我有一個腦電波,鍵入模塊重寫,現在終於到了某個地方... – Riskeh 2010-10-05 22:02:23
lol不要是卑鄙,沒關係我們都已經通過它。他是一個新用戶。別擔心。在發佈問題之前,請確保您自己也嘗試做一些廣泛的調查。用盡了所有你能想到的東西之後。 – Pavan 2010-10-05 22:02:49
不要擔心爲你發佈的東西。 – Pavan 2010-10-05 22:03:20