1
我想在我的.htaccess
幾個要素:的.htaccess 1個或2 GET參數
- 我希望所有的PHP文件通過訪問
/index
,而不必把.php
後,開始工作。
我使用:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
我有一個
index.php
頁,有時具有1個GET參數,有時2:- www.domain.com/?first=data
- www.domain.com/?first=data &第二= DATA2
- www.domain.com/?first=data
我用:
RewriteRule ^(.*)/(.*)$ index.php?id=$1&p=$2
RewriteRule ^(.*)$ index.php?id=$1 [L]
但是,如果我有2種元素它的唯一的工作;如果我用剛纔的第一個參數的鏈接,我得到一個錯誤頁面。
我該怎麼解決呢?
#2,看看'[QSA]'。 http://httpd.apache.org/docs/current/mod/mod_rewrite.html – cmbuckley