Accessing Your Wordpress Site From The Root Folder
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 wordpress.org 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
Related posts:
- Changing The URL Of Your Wordpress Site Wordpress web site owners often come to realize that they want to change the URL...
- Excluding Your Web Site From Search Engines People often write about how to increase your search engine ranking by using noindex and...
- Wordpress Plugins – User Access Manager vs. Role Manager Do you want to control access to your pages & posts or your admin features?...
- Wordpress Security – Protection Against Hackers There are a bunch of things you can do at no cost that will make...
- Wordpress – Getting started without getting startled Wordpress is an amazingly effective tool for allowing users to generate a cohesive, feature-rich web...

[...] Accessing Your Wordpress Site From The Root Folder I see a lot of [...]
Detailed…
I see a lot of people asking how to make their Wordpress site accessible from the root directory folder…
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! ^^
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?
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:
domain/wpfolder
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.
[...] help today and trying to understand their directions I became very frustrated, but then I found this site by John Nasta which explains everything [...]
I’m still frustrated. I followed your instructions and changed the .htaccess file code to this:
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} sidwebb.com$
RewriteCond %{REQUEST_URI} !WPress/
RewriteRule ^(.*)$ WPress/$1
I get a 404 page error. I can access the blog as usual this way:
http://www.sidwebb.com/WPress
Essentially I am having the same problem that I had using the method described by WordPress. Any ideas?
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 http://feefifaux.net before I learned how to do it with htaccess.
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} sidwebb.com$
RewriteCond %{REQUEST_URI} !WPress/
RewriteRule ^(.*)$ WPress/$1
The first line is the only difference.
Thanks again for the help.
I’m glad that you found the answer. I also found it through my web host.
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?
Thanks!
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]