Support » Installing WordPress » Installing WordPress In Root With Existing HTML Site?

  • I have an existing HTML site and my original intentions were to only use WordPress as a blog for now with the possibility of eventually converting my HTML site over to WordPress. Well, I have decided to just go ahead and convert my site over to WordPress now and get it over with and I have a couple of questions…

    Firstly, I already have WordPress installed in it’s own sub directory outside of the root… Just to clarify, i’m already aware of the procedure that is used to point your home site’s URL to a sub directory, which is explained at:

    I would really much rather just go ahead and put a fresh WordPress install in my root directory right now instead of pointing it there later. The problem is, when I do that, WordPress over-rides my existing index.html and WordPress loads instead of my existing site when I punch in my website URL. So… Is there any possible way I can install WordPress in my root directory, so I can develop it from there, but yet have my current index.html load when my web address is punched in until my WordPress integration is finished?

    My second question is, if the above isn’t possible, what exactly is going to happen to my URLs if I just continue running WordPress from a sub directory and point my home site’s URL to it later?

    For instance, I need my URL’s to be like this when i’m finished:




    I have also read that installing WordPress in the root directory is much better from an SEO standpoint and that when you install WordPress in a sub directory it causes duplicate content issues. Is that true?

    Any help or suggestions you guys can offer would be greatly appreciated.

    Thanks in advance.

    ~ Aedryan

Viewing 11 replies - 1 through 11 (of 11 total)
  • It sounds like your server is configured to look first at index.php and, if none is found, then look for index.html. (WordPress installs an index.php but does not overwrite or install index.html.) In that case, you need to add a .htaccess directive to tell the server to first call index.html instead of WordPress’ index.php.

    Check this out:

    The problem you’ll run into is that you’ll have a hard time developing your WP site because you won’t be able to see the home page (it will call your old index.html).

    What about installing WordPress in the subdirectory, developing your site in there, and then when you’re ready, move WordPress to the root and follow the instructions in the codex to update your URLs to point to your new root installation?

    Hey, thanks a lot for the info, New Nine. I really appreciate it! >8>)

    So… If I go ahead and continue developing WordPress in the sub directory, i’ll be able to completely MOVE the whole installation to my root (not just point my home site’s URL to the sub directory) without any problems?

    Thanks again, brother!

    ~ Aedryan

    Yes. govpatel gave you the link for instructions. We do it all the time – develop sites for clients in a directory of a testing server ( When it is done being developed, client loves it, and it’s full of content and ready to go live, we slide it over to the client’s URL.

    The most important thing to remember as you develop your site in a different directory is not to use hardcoded URLs in the theme. Use site_url() instead so that, when you make the move, everything just works.

    Thanks a lot you guys. New Nine, what do you mean exactly by “use hardcoded URLs in the theme. Use site_url() instead so that, when you make the move, everything just works”? Could you please explain this in a little more detail and give me some examples?

    Thanks again for your help. You guys are awesome!

    ~ Aedryan

    New Nine, are you still with me on this, bro? lol I’ve decided to go ahead and move forward with redeveloping my site with WordPress in the sub-directory it’s currently in then move the whole installation to my root once it’s ready to go live. I’m ready to start getting all of my navigation in order and I just need to be clear on what you said in the following comment:

    The most important thing to remember as you develop your site in a different directory is not to use hardcoded URLs in the theme. Use site_url() instead so that, when you make the move, everything just works.

    Can you please explain this a little further and give me some examples? I’m not sure what you mean by “hardcoded URLs” or by using “site_url()” instead…

    Thanks again for your help.

    ~ Aedryan

    Aedryan, to avoid hardcoded URLs, use relative URLs and paths throughout your theme.

    E.g., in your CSS, don’t do something like:
    background-image: url("");

    Rather, do this:
    background-image: url("images/example.jpg");

    So when you move your theme files, you won’t have to do a search and replace to remove “sub-dir” from URLs.

    Same thing applies to PHP includes, JavaScript registrations and CSS links. Go with native WP calls like the TEMPLATEPATH constant or get_bloginfo functions.

    Generally, these best practices make for a more portable, domain-independent theme or plugin.

    Gotcha, John. Thanks a lot, bro! I’m still confused about what happens to URLs after the installation is moved to the root, though. For instance; Will all of my URLs just automatically change from to

    By the way, I have been leaning towards a different approach, which would alleviate all of these possibilities of things getting corrupted (if I can get it to work). If one of you guys could take a look at my most recent post at the following link, I would REALLY appreciate it:

    Thanks again! >8>)

    ~ Aedryan

    Yes, all relative URLs and paths will automatically reflect whatever level you are — site root or sub directory. Nothing is “changing” per se, and that’s the point, since it’s all relative.

    At worst, when you make the transition, go to your combined options page at “/wp-admin/options.php” and check these option parameters: fileupload_url, home, siteurl, upload_path and upload_url_path.

    Gotcha John! Thank you much! >8>)

    Sorry Aedryan! johnfakorede is right on the stylesheet, but I was also talking about general theme files. If you are putting a “Contact Us” button in sidebar.php, for example, your link should not be but <?php print site_url('/contact'); ?>

    By doing that, your theme will use whatever URL you set in the configuration. If you’re moving from one URL to another, you won’t have to go back and change all of those theme files because the function will adapt.


Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Installing WordPress In Root With Existing HTML Site?’ is closed to new replies.