views:

85

answers:

1

Hi,

For a website I'm currently working on we're redirecting our old URL's permanently to new ones like this: Redirect 301 /oldfile.php http://www.site.com/show/newurl

Now I come across this situation in which the old url has a get var like: Redirect 301 /oldfile.php?var=name http://www.site.com/show/newurl

This will redirect the oldfile to the new url plus it adds the get var so it redirects to: http://www.site.com/show/newurl?var=name

How would I set up this redirect without the get var?

+1  A: 

mod_rewrite can strip off the query string:

RewriteEngine on
RewriteRule ^/?oldfile.php$ http://www.site.com/show/newurl? [R=301,L]
Ignacio Vazquez-Abrams
Thank you very much for the quick and clear answer!
tvgemert