.htaccess Redirect of old post links

Hi,

I'm currently trying to migrate a WordPress site and want to make sure all of the old post URLs out there still work.

The client has their WordPress blog setup in a subdirectory, http://example.com/blog on a Dedicated Server

The recently purchased a WordPress Managed server to host their primary site, http://example.com

We are now needing to move the blog access URL from "/blog" to a subdomain, blog.example.com.

What type of redirect do I need to put in the .htaccess file so that http://example.com/blog & all associated posts and pages point over to http://blog.example.com?

Example when someone visits the old URL of http://example.com/blog/post it redirects them to http://blog.example.com/post

Thanks for the help!

  • Michelle Shull

    Hi, Tyler!

    These are the steps you need to follow to make sure all the URLs on your new location are correct:

    1. Create the new location using one of these two options:
    1a.If you will be moving your WordPress core files to a new directory, create the new directory.
    1b.If you want to move WordPress to your root directory, make sure all index.php, .htaccess, and other files that might be copied over are backed up and/or moved, and that the root directory is ready for the new WordPress files.

    2. Log in to your site.

    3. Go to the Administration > Settings > General panel.

    4. In the box for WordPress Address (URL): change the address to the new location of your main WordPress core files.

    5. In the box for Site Address (URL): change the address to the new location, which should match the WordPress (your public site) address.

    6. Click Save Changes.

    (Do not try to open/view your site now!)

    7. Move your WordPress core files to the new location. This includes the files found within the original directory, such as http://example.com/wordpress, and all the sub-directories, to the new location.

    8. Now, try to open your site by going to yourdomain.com/wp-admin. Note, you may need to go to yourdomain.com/wp-login.php

    9. If you are using Permalinks, go to the Administration > Settings > Permalinks panel and update your Permalink structure to your .htaccess file, which should be in the same directory as the main index.php file.

    10. Existing image/media links uploaded media will refer to the old folder and must be updated with the new location. You can do this with the Velvet Blues Update URLs plugin, or with a search and replace tool, or manually in your SQL database.

    11. In some cases your permissions may have changed, depending on your ISP. Watch for any files with "0000" permissions and change them back to "0644".

    12. If your theme supports menus, links to your home page may still have the old subdirectory embedded in them. Go to Appearance::Menus and update them.

    13. Sometimes you would need to restart your server, otherwise your server may give out an error. (happens in MAMP software (Mac)).

    It is important that you set the URI locations BEFORE you move the files.

    More details here: http://codex.wordpress.org/Moving_WordPress

    Take care!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.