WordPress Hacks: Moving a Static HTML Site to WordPress

[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.

  1. Use 301 redirect rules in your web server’s .htaccess file. Drawbacks:
    1. 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.)
    2. The average blogger might not understand .htaccess rules.
    3. The .htaccess might not be accessible through your hosting account. (Depends on the host.)
  2. Use a WordPress URL redirection plugin. Drawbacks:
    1. 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.
    2. You are changing your entire site’s URLs. (See above)
  3. 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:
    1. 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.)
  4. 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:
    1. 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.
    2. 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.


  1. Your static site’s URLs end with .htm (though other extensions should work).
  2. You want to retain all old URLs when you move the site to WordPress.

Moving process:

This is a generic process. I’ll not get into the nitty gritty details unless someone asks.

  1. Backup all your existing static content to somewhere other than your web server. Keep the old pages as they are.
  2. 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.
  3. Install WordPress and configure it as you like.
  4. 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.
  5. 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.
  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.

4 thoughts on “WordPress Hacks: Moving a Static HTML Site to WordPress

  1. Hi Raj – thanks for this post – I have successfully replaced an old static HTML site with Worpress, and modified my .htaccess file to do a 301 redirect from all of the old pages to the new pages – all is working fine EXCEPT for my old index.html file – I would not worry about it except that for some odd reason it has been indexed in a few places and there are still some old links to it out there – these are links specifically to this old page, not to our domain, which is working fine.

    Not having any reference to the old index.html in my .htaccess file, those links now give a 404 error – far from ideal.

    I tried adding a line to my .htaccess file for it, but my browser tells me I’m creating a loop and won’t follow a redirect, even if I redirect to index.php.

    Can you offer any suggestion for how to handle this specific old “home” page?

  2. Hi,

    Try this :

    Line 1141, /wp-includes/rewrite.php

    $this->page_structure = $this->root . ‘%pagename%’;

    Change to:

    $this->page_structure = $this->root . ‘%pagename%.html’;

  3. I think using a 301 redirect is the best option, and I haven’t noticed any penalty from google on the sites I’ve used. You should also consider step 3, but I don’t think you need to make them exactly the same, just changing the permalink structure in the wordpress options to make them similar. If you do want to go down that route, you’ll likely have problems that aren’t worth the effort.

  4. Hi Raj

    First, thank you for writing this post … it answered my EXACT question directly.

    However, I’m still having some issues.

    Let me describe the process I’m going through:

    I’m trying to migrate my static site into WordPress and I NEED to match this URL:


    I tried changing the slug into the post permalink edit option but what happens is the following:

    The URL is now changed to http://www.signaturehouston.com/houstonbankforeclosureshtm

    In other words, WordPress removes the dot in front of htm.

    Any ideas?

    Thank you

Comments are closed.