如果传递某个GET
参数,是否有方法在.htacess
中制定不同的重写规则?
例如,如果查询字符串是:
htttp://domain.com/?debug=1
,比.htaccess
应该是这样的:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
如果在查询字符串没有debug=1
,比:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule !\.(js|ico|gif|jpg|png|css|html|swf|flv|xml)$ index.php?$1 [QSA,L]
你的问题是什么? – starkeen
@Starkeen我问过是否可以实现我在文章中描述的构造。其实,我的第一句话是个问题。我会再次重复一遍:有没有一种方法可以根据请求GET参数制定不同的重写规则。 –
你的意思是说,如果在URL中有查询字符串,那么它应该重写为index.php,否则app/webroot /? – starkeen