This has been asked several times:
“How do I get my WordPress blog to LOOK like it’s in the root directory…when it actually is not.”
What has happened, is that you’ve grown tired of how long your URL is, like “http://www.my-blog.com/wordpress/my-awesome-post/”. You want to get rid of that “wordpress” part.
Personally, I like having WordPress installed in its own tidy directory. It makes the “root” look SOOOOOO much cleaner. So, Fire-up your favorite FTP Client and your text-editor of choice and I’ll show you how it’s done:
- Log into your WordPress blog and (in version 2.7+) click Settings->General
- In the box under Site or Blog address (URL):, change your blog’s address to the location where you want it to APPEAR to reside. If it reads “http://www.my-blog.com/wordpress”, simply remove the “/wordpress” part.
- In the box labled WordPress address (URL):, leave it ALONE. This is where your WordPress installation resides…and WordPress needs to know EXACTLY where it resides…else it won’t work.
- Next, Click on “Save Changes” at the bottom of the page.
- You may get a warning, but ignore it.
- Fire up your FTP client and browse to the WordPress installation directory.
- Copy the “index.php” and the “.htaccess” files (from the WordPress address (URL) folder) to the directory where you want WordPress to appear to reside. Mostly, this is the Blog address (URL) or the “root” directory. You know…the part left over after you lopped-off the “/wordpress” part?
- Now, open the newly pasted/uploaded “index.php” file in the root directory with a text editor.
- Look for the line that says “require('./wp-blog-header.php');" and change it to read “require('./wordpress/wp-blog-header.php');" If WordPress is installed in some other directory, change "./wordpress" to the name of the directory that WordPress is actually installed.
- Next, log into your WordPress blog, but don’t be surprised if it is still “http://www.my-blog.com/wordpress/wp-login.hp”. If that’s not working, try “http://www.my-blog.com/wp-login.php”.
- Got to “Settings->Permalinks” and refresh/re-save those Permalinks (“Save Changes”).
- So, if WordPress is unable to add the URL rewriting rules to your “.htaccess” file (that we copied into the root directory), then WordPress will give you those new rules, which you can copy/paste manually into the “.htaccess” file on your own…using FTP and your text-editor, of course. Most of the time… and I DO mean MOST… this works flawlessly.
There. All done.
NOTE: If refreshing your browser does NOT yield positive results, then there may be a caching issue between your browser and your hosting site…
In Case of Fire, Try this:
- Copy the edited ‘index.php’ file to a local area on your computer (like your Desktop).
- Delete the edited ‘index.php’ file from the server. YES! I know. We just put it there… trust me.
- Refresh your browser. It SHOULD complain since your ‘index.php’ file is no longer on your server. At the very least, you should see your hosting package’s website.
- Copy the edited ‘index.php’ file BACK to the root directory of your server.
- Refresh your browser. You SHOULD see your website back up and running…AND appearing as if it is all coming from the root directory.
A BIG thanks to ‘NerdyKitty’ for finding this ‘bug’. It appears that the server holds a temporary copy of the ‘index.php’ file… causing it to use the OLD version of the ‘index.php’ file when it SHOULD be using the edited (and moved) version.