Andy
Andy

Reputation: 3021

redirect including query string with .htaccess

I need to redirect a page like this (values could change in query string)

http://www.domain.com/list.php?id=bla&variable2=product1-product2-product3

Redirect to

http://www.domain.com/list.html?id=bla&variable2=product1-product2-product3

All i need is it to change to .html but everything else should remain the same on the bespoke links.

Any help out there?

Upvotes: 0

Views: 56

Answers (2)

Dark
Dark

Reputation: 515

Put this in you htaccess, it should be enough.

RewriteRule ^([^.]+).html$ /$1.php [QSA,L]

(And by the way, it's useless to do this...)

Upvotes: 0

Snow Blind
Snow Blind

Reputation: 1164

Is it a bad idea to do the redirection in list.php file instead of using an .htaccess file?

How about something like:

header('Location: http://www.domain.com/list.html?'+$querystring);

in list.php?

Upvotes: 1

Related Questions