I’ve recreated a new site using WordPress on an Apache server that used to be a .NET site, the old page URLS look like this:
Page.aspx?p=70
I need to 301 redirect all of the pages to their new pretty URLS using .htaccess
When I use
Redirect 301 /Page.aspx?p=70 http://example.com/foobar
It doesn’t work, and WordPress sends it to
/?attachment_id=70
My .HTACCESS looks like this
Redirect 301 /Page.aspx?p=70 http://example.com/foobar
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Have it this way:
And remember that
%{QUERY_STRING}
is not matched usingRedirect
directive.