mod_rewrite两个变量一个索引

时间:2014-01-22 01:16:29

标签: apache mod-rewrite rewrite

我有这样的规则并且有效:

http://domain.com/rewrite points to index.php?page=rewrite

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(\w+)$ ./index.php?page=$1 [QSA,L]

现在我需要再添加一条规则:

index.php?run=rewrite&task=more-stuff

并指向

http://domain.com/rewrite/more-stuff

任何想法如何做到这一点?

1 个答案:

答案 0 :(得分:1)

也许

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(\w+)$ ./index.php?page=$1 [QSA,L]
RewriteRule ^(\w+)/([\w-]+)$ ./index.php?run=$1&task=$2 [QSA,L]