Problem facing using .htaccess file

Avatar
  • Answered
Hi, I have two pages with same no of GET variables..URLs when no rewrite rule is being followed are

www.ludhianaweddings.com/vlist1.php?cat=ABC&scat=BCD
www.ludhianaweddings.com/vlist2.php?cat=ABC&area=DEFG

When i define a rewrite rule in .htaccess file it becomes

www.ludhianaweddings.com/ABC/BCD
www.ludhianaweddings.com/ABC/DEFG

and rewrite rules are

RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ vlist1.php?cat=$1&scat=$2 [QSA,L]
RewriteRule ^([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ vlist2.php?cat=$1&area=$2 [QSA,L]

My problem is if i want user to redirect to vlist2.php wiht the url www.ludhianaweddings.com/ABC/DEFG it redirects user to vlist1.php...How i can solve this problem ? Thanks a lot...
Avatar
Arn
Hello, Thanks for asking about how to setup your re-write rules. The issue you're stating is that you have a specific condition that you want to address that will bring a user to "vlist2.php". However, you have two general rewrite rules that have no stipulating conditions. As rewrite rules are enforced from top to bottom, you need to create a condition that matches the URL that you want to redirect to vlist1. Then if the condition fails, it goes to the other rules. This web site does a great job of explaining the query string redirects. They also give examples of setting up a condition before the actual rewrite rule. If you have any further questions or comments, please let us know. Regards, Arnel C.