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