Reputation: 8360
I want to have a url like this:
domain.com/css/site.css?test=234
Rule:
RewriteEngine On
RewriteRule ^([a-z]+)/$ $1.php
RewriteRule ^css/([a-zA-Z0-9]+).css?count=(.*)$ css.php?f=$1&test=$2
But I get every time a 404: Not found (site.css)
If I have a rule like that it works, just without getting the $_GET-Variable:
RewriteEngine On
RewriteRule ^([a-z]+)/$ $1.php
RewriteRule ^css/([a-zA-Z0-9]+).css$ css.php?f=$1
Upvotes: 2
Views: 144
Reputation: 17817
Query string is not present in url to be matched by RewriteRule. You need something like this:
RewriteEngine On
RewriteRule ^([a-z]+)/$ $1.php
RewriteCond %{QUERY_STRING} count=(.*)$
RewriteRule ^css/([a-zA-Z0-9]+).css$ css.php?f=$1&test=%1
You can read more about RewriteCond
and RewriteRule
here http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteCond
You can see order in which RewriteConds and RewriteRules are executed here http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#InternalRuleset
Upvotes: 2