Question

I have a website which is being renewed.

It has url's like site.com/page.php?p=company&l=nl The new URL is site.com/company

I would like to use .htaccess to redirect 301. (I would like to keep the SEO pagerank for the old pages)

Because of the ? it doesn't work.

This is the rule I use in my htaccess which doesn't work:

Redirect 301 /page.php?p=company&l=nl http ://www.site.com/company

This is the rule I use in my htaccess which does work:

Redirect 301 /page.php http ://www.site.com/company

I need the ?p=...

Était-ce utile?

La solution

This should work:

RewriteCond %{QUERY_STRING}  ^p=company&l=nl$ [NC]
RewriteRule ^page\.php$ http ://www.site.com/company? [R=301,NE,NC,L]

Remove the space between http and :

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top