[intermediate] Sonzy, a member of Hive, wanted to know, after moving a static HTML site to WordPress, how you retain the old URLs. That is, the old site’s URLs ended with “.htm”, and WP changes these to URLs based on postname and possibly the date, depending on how have WP permalinks set up. There are a few options, if your old URLs ended with .htm, .html, or other variations.
- Use 301 redirect rules in your web server’s .htaccess file. Drawbacks:
- You are changing your entire site’s URLs. Doing this might incur a temporary SERPs (Search Engine Results Pages) penalty and changing your rankings. (I’m not saying this will happen, just that it might.)
- The average blogger might not understand .htaccess rules.
- The .htaccess might not be accessible through your hosting account. (Depends on the host.)
- Use a WordPress URL redirection plugin. Drawbacks:
- This one is relatively easy to implement, but I’ve only ever tried it from within WP. That is, I didn’t move from a static HTML site. I already had a WP site and wanted to go from an old permalink URL structure to a new one. I haven’t tried it, but I think using a plugin will complicate matters in this case, unless you find a specific plugin designed to handle this.
- You are changing your entire site’s URLs. (See above)
- Tweak the new permalinks and URL slugs in WordPress. This ensures that all your URLs stay the same as on your static HTML site. Drawback:
- Lot of manual work. Unless you know how to write SQL queries, you’re going to have to do this manually. (Even if you do know SQL, you may not want to use it.)
- Install WordPress over top of your existing site. In the past, I’ve successfully had two different websites living on the same domain. One was a static site that had URLs with .html, and the newer site was in WordPress. This is a fairly simple upgrade. Drawbacks:
- The old /index.html page will still exist, but will not get served. That will be auto-redirected to / (your new WP home page). However, all the other old URLs will exist and be visible. So you’d have to manually port any content/ media from the old home page to the new one.
- Unless you change the layout of the old pages to match, they will have a different theme than your new WordPress site.
These are the options I’ve used to date, for moving from a static HTML site to a WordPress site. (This will apply for any platform that does not generate an /index.html for the home page.) Options 3 and 4 both retain the old URLs (with the exception of the old homepage for option 4).
If you’re dead set on changing your old pages to WordPress but want to retain the URLs, option 3 is what you want. (If anyone has other suggestions, please do comment.) However, if you have lots of posts, expect tedious porting work ahead. (Note: You could have a situation where a search spider comes along and indexes your new URLs and finds your old ones missing. I’m merely pointing this out, but I’m not sure what the likelihood of this happening, on average, is.)
Option 3: Manually Tweaking Your URLs in WordPress
Now to provide a quick overview of the process you might apply, to port a static HTML site to WordPress.
- Your static site’s URLs end with .htm (though other extensions should work).
- You want to retain all old URLs when you move the site to WordPress.
This is a generic process. I’ll not get into the nitty gritty details unless someone asks.
- Backup all your existing static content to somewhere other than your web server. Keep the old pages as they are.
- Make a list somewhere in a file of all your old URLs, matched with each page’s title. Keep this file open, as a reference.
- Install WordPress and configure it as you like.
- Go into the “permalinks options” and adjust as necessary. E.g., if old URLs are of the form /this_is_page_1.html, then you can use the permalink option /%postname%/ (provided that the old URLs are partially based on the old page titles). If your old URLs used year and/or month and/or day, things get a bit more complicated, but the same general process applies. Just pick the most suitable WP permalink option, or customize as necessary.
- On a post-by-post basis, compare your new WP URLs to the old ones. If they are all identical, you’re done. If not, go to step 6.
- On a post-by-post basis, use the Write/Edit panel to edit the new WP posts. Change the post “slug” to match. (Depending on which WP version you’re using, it might be labelled “permalink”.) Manual changes to a post (or page) slug partially overrides the permalink options. (It does not affect any date, category, or post id segments of the URL.)
Keep in mind that in WP, URLs are assigned based on the title of the post or page, as well as which permalink option you’ve used. For simplicity of explanation above, I’m assuming that neither old nor new URLs have any dates in them.
Before deciding on the course of action, weigh out the consequences of each option, as well as the work you’ll need to do to port your site. If you’re not sure which permalink option to use, drop a comment here with a few examples of your old URLs and how you want them now. I’ll do my best to answer.