views:

55

answers:

0

Hi there,

I'm trying to redirect a page using PHP (I think it has to be PHP as opposed to .htaccess as there are a lot of pages involved and the information required to do the redirect is held in a datbase).

The page i'm trying to to a redirect from is already re-written, and looks like:

www.example.com/shop/deptartment/section/product1/

Which re-writes to www.example.com/content.php?dept=department&sect=section&prod=product

However when I use the php header($url,TRUE,301); with $url being (For example) www.example.com/shop/deptartment/section/product2/ it re-directs to:

www.example.com/shop/deptartment/section/product2/?dept=department&sect=section&prod=product

Wheras all I want is www.example.com/shop/deptartment/section/product2/

I know how to stop this in .htaccess but not php, any ideas ?

Many thanks,

Stuart

p.s. rewrite rules are:

RewriteRule ^shop/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)/?$ /content.php?dept=$1&sect=$2&prod=$3 [L,NC,QSA]
RewriteRule ^shop/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)/?$ /content.php?dept=$1&sect=$2 [L,NC,QSA]
RewriteRule ^shop/([a-zA-Z0-9\-_]+)/?$ /content.php?dept=$1 [L,NC,QSA]
RewriteRule ^shop/ /content.php [L,NC,QSA]