I have a number of RewriteRules in my .htaccess file. However, one specific rule is only executed if I remove another specific rule, regardless of how I order the two rules.
Here's the rule which seems to have "lower" priority:
RewriteRule ^([0-9]+)$ /beta/forward.php?id=$1 [L]
And here's the rule which always takes precedence:
RewriteCond %{HTTP_HOST} ^domain1\.net$ [NC]
RewriteRule ^(.*)$ http://domain2.net/$1 [R=301,L]
Both domain1 and domain2 actually point to the same web site. So, whenever both rules are in the .htaccess file and I access
http://domain1.net/123
The second rule gets executed first and I get two redirects, first to http://domain2.net/123 and then (when the host name doesn't fit the second rule anymore) to http://domain2.net/beta/forward.php?id=123. I've tried fixing the second rule so it is never executed for urls which only contain numbers, but I must be doing something wrong, because it still gets executed:
RewriteCond %{HTTP_HOST} ^ domain1\.net$ [NC]
RewriteRule ^(.*[^0-9]+.*)$ http://domain2.net/$1 [R=301,L]
Only be removing the two lines from the .htaccess file can I get the first rule to handle the request right away.
Any help would be greatly appreciated.