2010-10-05 93 views
1

重寫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的來達致這,我想這與某種形式的正則表達式的實現。

我該如何達到這個結果?

+0

那麼你可以通過標題我很沒有看到知道如何說出來,並找到我需要的...不用謝了你,我有一個腦電波,鍵入模塊重寫,現在終於到了某個地方... – Riskeh 2010-10-05 22:02:23

+0

lol不要是卑鄙,沒關係我們都已經通過它。他是一個新用戶。別擔心。在發佈問題之前,請確保您自己也嘗試做一些廣泛的調查。用盡了所有你能想到的東西之後。 – Pavan 2010-10-05 22:02:49

+0

不要擔心爲你發佈的東西。 – Pavan 2010-10-05 22:03:20

回答

1

打開重寫引擎。當第一個參數被調用時,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

0
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要麼導航,或者只是顯示的內容