Accessing Your WordPress Site From The Root Folder

Update June 06, 2010 – This is an old post and I actually never do this any more. Please see the comments. Thanks.

I see a lot of people asking how to make their WordPress site accessible from the root directory folder. In most standard installations, WordPress is installed in a sub-folder and the only way to access the site is to add that sub-folder name to the site’s URL.

If you read the support forum you’ll find posts suggesting that you move the WordPress index.php file to the root folder and change a few things in that file. You’ll also see replies from people who have tried it unsuccessfully.

Here’s a little trick that will allow you to access your WordPress site from the root URL without moving or modifying any of the WordPress installation files. This method will “hide” the WordPress installation’s folder name when people access your home page but they will see the folder name in URLs when they start clicking around…

Check your root folder for a file called .htaccess (note that the dot is before the file name). If there is one, download it. If not, create one with a plain text editor such as Windows Notepad. Make sure that when you save it, the file type is set to “All Files” so that your editor doesn’t try to add an extension onto the file name.

Make sure that these lines are included in your .htaccess file. For this example the root URL is shown as domain.ext and the WordPress folder is shown as wpfolder. You will have to change these values to match your own domain name, extension, and WordPress folder name:

RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} domain.ext$
RewriteCond %{REQUEST_URI} !wpfolder/
RewriteRule ^(.*)$ wpfolder/$1

Upload this file to the root directory of your web server as a plain text file. You’re done!

Now go to Google Webmaster Tools and let them know the “preferred URL” of your home page so you don’t get penalized for duplicate content.

This article copyright © John Nasta 2009 – All Rights Reserved
Be Sociable, Share!

You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.


  • Tim says:

    Ok so I know this is a really old post by now but was wondering if this is a similar issue and if you had a work-around for it… I want to access my WP admin from the root domain with an SSL and keep the rest of the site with www in front of it. Is this possible? And can I do that with some kind of redirect without moving WP files around.

    My purpose is to remove the SSL from any part of my site that uses www in it so that I can take advantage of cloudflare’s free service. No need to pay them if all I want is a secure WP admin.

    Thanks for any light you could shed on this


  • sam says:

    I am working on a website:

    how do I remove ‘portfolio’ from all the links so that I can open the links,, etc.

  • graceperson says:

    (I added this same question on wordpress help, but thought I should add it here too)

    Ok – Here is what I am trying to do. I would deeply appreciate your help because I think I am trying to do what you describe. I want to just look like

    Call my site

    wordpress exists in:

    I have subdirectories for each area under wordpress:


    Currently, I have a redirect: to

    I added the code you have listed above to the root directory .htaccess file (with all the redirects) and it didn’t seem to affect anything.

    Not sure what is going on.

    • John Nasta says:

      Hi there. This is an old post and I don’t ever use this method any more. I’m not sure why you want /home appended to your home URL and I don’t know what you mean by “I have subdirectories for each area under wordpress”. Also that little trick I posted is only for accessing the home page from the root URL. The real, best way to move your WordPress installation to the root folder (requires knowledge of FTP so read first) is…

      • Log in to admin. Go to Settings > General and take the subfolder path (/wordpress) out of both URIs. Save changes.
      • Your site will appear to be broken – that’s fine
      • Download all of the WordPress files from your server’s /wordpress folder via FTP
      • Edit the .htaccess file from your /wordpress folder (if present) to remove /wordpress path in two places (you’ll see it – this file is only created if you have altered the default Peramlinks setting in Settings > Permalinks)
      • Upload all of the files from your /wordpress folder to the root directory on your server
      • Visit your site at the root URL and make sure it looks ok. Log into the admin.
      • If all is ok, you can delete the /wordpress folder on the server. This is usually most easily done through your host’s CPanel or Plesk File Manager
      • Go to Settings > Miscellaneous and take /wordpress out of the upload path if necessary
      • Check any other plugins that store or access data on your site to make sure their paths are correct


  • graceperson says:

    I added your code into the root directory .htaccess file but it did not seem to change anything in the URL but all my images became broken.

    This is what I added:

    RewriteEngine On
    Options +FollowSymlinks
    RewriteCond %{HTTP_HOST}$
    RewriteCond %{REQUEST_URI} !wordpress/
    RewriteRule ^(.*)$ wordpress/$1

  • dmibizz says:

    Hi. Thanks for this it works well. Just wondering why you’re not using the last bit in the .htaccess statement i.e. [R=301,L]

    Do you if we should add it to it or nor?

    • John Nasta says:

      I’ve read that this code will insure that search engines do not penalize your site for duplicate content:

      Options +FollowSymLinks
      RewriteEngine on
      # index.php to /
      RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9}\ /.*index\.php\ HTTP/
      RewriteRule ^(.*)index\.php$ /$1 [R=301,L]

      There are lots of examples of this type of code available by doing a web search for htaccess redirect.

      Here’s a link for searching Google.

      Unfortunately they often give you the code but fail to explain how or why it works. I have also seen examples that end with [L,R=301]

  • Sid Webb says:

    I’m still frustrated. I followed your instructions and changed the .htaccess file code to this:

    RewriteEngine On
    Options +FollowSymlinks
    RewriteCond %{HTTP_HOST}$
    RewriteCond %{REQUEST_URI} !WPress/
    RewriteRule ^(.*)$ WPress/$1

    I get a 404 page error. I can access the blog as usual this way:

    Essentially I am having the same problem that I had using the method described by WordPress. Any ideas?

    • John Nasta says:

      Is your site on a Windows server or a Unix server? This mod rewrite rule may only work on Unix servers. I have no sites on Windows servers and don’t know the particulars of how to make it work on Windows servers.

      You may also be able to go into your hosting control panel and use a redirect. That’s how I did it on before I learned how to do it with htaccess.

      • Sid Webb says:

        I use a Mac. I’m not sure what the server is. But thanks for the clue. It never occurred to me to look in the obvious place (my web host) for an answer. Using the host’s tool I was able to redirect successfully. Here is the code it created:

        Redirect /index.php http://WPress/index.php

        Options +FollowSymlinks

        RewriteEngine On
        RewriteCond %{HTTP_HOST}$
        RewriteCond %{REQUEST_URI} !WPress/
        RewriteRule ^(.*)$ WPress/$1

        The first line is the only difference.

        Thanks again for the help.

  • Making Wordpress Your Root URL — Shiny Moon Beams says:

    […] help today and trying to understand their directions I became very frustrated, but then I found this site by John Nasta which explains everything […]

  • mugger says:

    Neat! This took over what I had been doing with 301 redir, and made the displayed URL now be my domain, not domain/wpfolder.

    No root index.php for hack attacks.

    Am I wrong to assume this helps site security as well as displayed URLs?

    • John Nasta says:

      Just keep in mind that w/ that .htaccess file in place, you can’t access folders that are outside of the folder you are redirecting to. So, if you are redirecting the URL to:


      you can’t access another folder called domain/otherfolder because it will look for it as domain/wpfolder/otherfolder. Basically the rule assumes that the folder you have it set to is always the root, and you can’t access something outside of the root. It would have to be under the root.

  • bananasplit says:

    I’ve had your blog in my bookmarks for a couple of days now and just wanted to say that I really love your articles! ^^

  • Detailed says:


    I see a lot of people asking how to make their WordPress site accessible from the root directory folder…

  • vs. | - Themes says:

    […] Accessing Your WordPress Site From The Root Folder I see a lot of […]


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>