Web Hosting Talk







View Full Version : htaccess rewrite with GET reqs.


RS Shamil
08-30-2009, 02:34 PM
Hello, how do I configure my .htaccess rewrite rules to accomodate GET requests?
Currently, /manager/page goes to: ?dept=manager&n=page however, some pages have additional GET reqs, and so this rule doesn't work:

RewriteRule ^([A-Za-z]+)/([A-Za-z]+)$ index.php?dept=$1&n=$2 [QSA]

I require: ?dept=manager&n=page&id&etc=etc to go to: /manager/page/id/5/etc/6 however, not all pages present the same method of id input, IE. some pages used id, others catid, and others, bugid, so it's a bit difficult.

I am however, trying to change all of these GETs to id to make things easier.

siv9
09-02-2009, 11:46 AM
I don't know if you can (or should) use Mod_rewrite to do this. I would just write a PHP script to take those variables in, then issue a

header("Location: /path/to/new/location");

It'd also be wise to use preg_replace to strip out all non alphanumeric characters out of each of the GET parameters (to help prevent improper routing)