Redirect Generator · Tutorial

How to redirect old URLs after moving your site

8 min readintermediateUpdated

Your shop moved from old PHP pages to clean URLs, and the old links still bring in visitors. This tutorial pastes a mapping of old to new addresses into the Redirect Generator, fixes the problems it reports and produces rules for your server.

What you need

  • The Redirect Generator
  • A list of old and new addresses, or the sample from the Try it button

Steps

  1. Paste the mapping

    Paste your list, one redirect per line. Lines starting with # are notes. The sample includes old product pages with query strings, a whole old shop folder and a few renamed pages.

  2. Let full URLs become paths

    Old addresses copied from a browser, like https://www.example.com/products.php?id=12, are reduced to /products.php?id=12. The domain doesn’t matter for redirects on your own site.

  3. Fix the chain

    The warnings list shows that /about.html redirects to /about, which itself redirects to /about-us. Change the first line to point straight at /about-us, so visitors take one hop instead of two.

  4. Choose your server

    Pick your server under Server. For Apache, the query-string lines become RewriteCond and RewriteRule pairs, because a plain Redirect ignores everything after the question mark.

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^id=12$
    RewriteRule ^products\.php$ /products/bento-box-bamboo? [R=301,L]
  5. Add the whole-site rules

    Tick Send http:// visitors to https://, choose Always without www and type your domain. These rules come first, so every visitor ends up on one canonical address.

  6. Install and test

    Follow the note under the rules to put them in the right file. Then open a few old addresses in a private window and check that each lands on the right page in one step.

Try it yourself

Opens the Redirect Generator with this tutorial's sample loaded.

Try it now

Common mistakes

Redirecting everything to the home page
Sending all old pages to the home page frustrates visitors and is treated like a missing page by search engines. Map each old page to its closest new page.
Using 302 for a permanent move
Temporary redirects tell search engines the old page will come back. Use 301 or 308 for a move.
Removing redirects too soon
Old links live on for years. Keep the redirects in place long term.

Next steps

Go back to the Redirect Generator, or keep going with one of these:

FAQ

How many redirects can I add?

As many as you need; thousands of lines are fine. Very large lists are often better handled with a redirect map in nginx or your platform’s bulk tools.

Does the trailing ? in the Apache rule matter?

Yes. It removes the old query string from the new address, so visitors don’t land on /products/bento-box-bamboo?id=12.