I have a folder and file structure already in place for a site to which I am inserting WordPress. My goal is to execute WP at the root level (/) when a visitor just visits the domain without a path, however I want WP to be installed within the wordpress subfolder folder.

So far I've reviewed several hits on this, but every single one of them appear to have the negative side effect of pushing the user on over to http://mydomain.tld/wordpress rather than keeping the user on /.

How can this be accomplished? I am guessing it is going to take some massaging of .htaccess in both the root folder and the other subfolders to which I want to grant access aside from WordPress, but I'd like to see this delineated properly.

One thing I have tried is to follow the Codex suggestion "Pointing your home site's URL to a subdirectory". In this I have updated my .htaccess as per what is there, however the site is consistently redirected to http://mydomain.tld/wordpress. I obviously want it to just be mydomain.tld without the additional wordpress path.

I have further attempted to do the following, with the mydomain.tld loading up the wordpress blog, but then seemingly when I go to any page, such as the default sample page that is installed with a fresh installation, it then adds the subfolder path again mydomain.tld/wordpress/blah:

in /index.php:

 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 * @package WordPress

 * Tells WordPress to load the WordPress theme and output it.
 * @var bool
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */

and /.htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]


# END WordPress

Also, the wp_options table siteurl has http://mydomain.tld/wordpress in it as well.

  • This is a Multisite .htaccess, are you running MS?
    – brasofilo
    Commented Feb 14, 2013 at 4:47

2 Answers 2


WordPress has a good writeup about this at Giving_WordPress_Its_Own_Directory.

Many people want WordPress to power their site's root (e.g. http://example.com) but they don't want all of the WordPress files cluttering up their root directory. WordPress allows you to install it into a subdirectory, but have your blog exist in the site root.

You could also just redirect from the root directory to /wordpress but keep the URL aliased as mydomain.tld.

  • Well bvillebud, thanks for that, but this is one of the hits noted that I've reviewed. This still seems to redirect / -> /wordpress every time the root is loaded. This is not desirable, I want /wordpress/ to function within /.
    – ylluminate
    Commented Feb 14, 2013 at 2:40
  • have you tried 'Pointing your home site's URL to a subdirectory' at the bottom of that page? It does a redirect.
    – bvillebud
    Commented Feb 14, 2013 at 2:46
  • @ylluminate, you don't mention the Codex in your Q... What doesn't work about it? What do you mean by "function within /"? ::: Please, update the Q itself.
    – brasofilo
    Commented Feb 14, 2013 at 2:47
  • @brasofilo Please take a look at the additions there now.
    – ylluminate
    Commented Feb 14, 2013 at 3:01

As long as siteurl includes the /wordpress it will redirect there. Get rid of it and everything should work fine. The instructions in the Codex you already mentioned worked for me many times.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.