Support » Fixing WordPress » 301 redirect old site URLs

  • Resolved joffff


    An old site has been redesigned using WordPress and I’d like to redirect old pages to their equivalent in WordPress.

    The old site used a CMS which had pages in the format of index.php?page=2 which conflicts with WordPress’s own querystring structure. I’ve got around 20 URLs to redirect, all as index.php?page=x

    I’ve tried using mod_rewrite as such:

    RewriteCond %{QUERY_STRING} page=2
    RewriteRule ^index\.php$ [R=301,L]

    But of course WordPress treats it as it’s own URL and not a rewritten one. Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Ipstenu (Mika Epstein)


    Lead Plugin Wrangler

    Did you put that ABOVE the WP calls in htaccess?

    No, I’d put it after!
    Thanks, it’s now at least acting on the rule first, but it’s now getting caught in a redirect loop.

    If it helps, the entire .htaccess contents are:

    DirectoryIndex index.cgi index.php
    RewriteCond %{QUERY_STRING} page=2
    RewriteRule ^index\.php$ [R=301,L]
    # 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]
    # END WordPress

    Removing the L from the redirect rule just gives a 301 Moved Permanently message.

    I’ve come up with a solution, but not sure if it’s the correct one. Instead of redirecting to the permalink URL (which wasn’t working as above), I’ve redirected to the non-permalink URL (

    Moderator Ipstenu (Mika Epstein)


    Lead Plugin Wrangler

    That works too. It you only have 20 pages, though, you may as well just do this:

    Redirect 301 /index.php?page=2

    for all 20.

    Thanks (again), that’s much simpler! 😀

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘301 redirect old site URLs’ is closed to new replies.