Forum Moderators: phranque

Message Too Old, No Replies

Multiple rewrite rules within .htaccess

         

abhi11kumar

9:15 am on Jun 17, 2011 (gmt 0)

10+ Year Member



RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /products.php?brandid=27&pname=$1 [NC]
The above works only for branid=27


and If I include mutilple statements, LIKE
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /products.php?brandid=27&pname=$1 [NC]
RewriteRule ^(.*)$ /products.php?brandid=42&pname=$1 [NC]
RewriteRule ^(.*)$ /products.php?brandid=47&pname=$1 [NC]
it will also run for brandid 27.


I tried lots of stuff but wont able to rewrite rules for mutiple brandid.

For Example:
The url [3gphone.in...] redirects [3gphone.in...]

lucy24

6:13 pm on Jun 17, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It is probably better if you start by explaining what you want to do. But note right away that RewriteCond (one or more of them) only applies to the immediately following rule. The subsequent rules will run regardless of condition. If the example you gave here were really in your htacces, everything would end up rewritten to brandid=47 because that happens to be the very last rewrite.

Use example.com for your, er, examples. In general, people need to see exactly what you typed; anything other than "example.com" gets obfuscated and will turn into active links.

Is there something special about brandid=27 or are you trying to capture any number
(\d+) or possibly ([0-9]+)
and use that same number
$1
in the rewritten address?