Don Sevcik
Don Sevcik

Reputation: 915

301 redirect to new page keep query string

I want to do a 301 redirect from old_page.php to new_page.php and keep all query strings if they exist.

so old_page.php would redirect to new_page.php

old_page.php?test=1 would redirect to new_page.php?test=1

Here is what I have below, but it's a 404 error.

RewriteEngine on 
RewriteRule ^old_page.php(.*) new_page.php$1 [R=301,L]

Upvotes: 3

Views: 5047

Answers (1)

Don Sevcik
Don Sevcik

Reputation: 915

This worked:

Redirect 301 /old_page.php /new_page.php

Upvotes: 8

Related Questions