I'm trying to setup my Wordpress projects so that I can have http://www.example.com/ as my site URL, say mapped to /var/www/vhosts/www.example.com/ and in there, I would like to use the following structure:


I would like wp-core/ to contain the Wordpress core installation as an svn:external and with wp-content and wp-config.php stored in my SVN repo, containing themes, config, etc. for each site.

The following article appears to explain how to go about setting the above structure up: http://codex.wordpress.org/Installing_WordPress_With_Clean_Subversion_Repositories

However, I'm hitting an issue where the site loads up correctly, reads it's config from the wp-config.php file above wp-core as intended, however when I attempt to log in, Wordpress redirects the request from http://www.example.com/wp-login.php to http://www.example.com/wp-login.php/ - note the trailing slash.

Here's a confirmation of the extra lines in wp-config.php I've added for this:

define('WP_CONTENT_DIR', dirname(__FILE__) . '/wp-content');
define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content' );

Here's the relevant rows from wp_options in my DB:

SELECT option_name,option_value FROM wp_options WHERE option_name = 'home';

SELECT option_name,option_value FROM wp_options WHERE option_name = 'site url';

Here's my .htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
    # Hey-ho let's go!
    RewriteEngine On
    # Base is the URL path of the home directory
    RewriteBase /
    # Base goes to WordPress
    RewriteRule ^$ /wp-core/index.php [L]
    # Skip real files and directories
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Otherwise send it to WordPress
    RewriteRule .* /wp-core/index.php [L]
# END WordPress

Tracing this in Chrome, I can see that a HTTP 301 from the correct address to the address with the trailing slash is returned by the server, so it would point to the .htaccess above, however the first line of the following excerpt contradicts this somewhat: - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (2) init rewrite engine with requested uri /wp-login.php/ - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (1) pass through /wp-login.php/ - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] add path info postfix: /Users/joe/tmp/example.com/trunk-new/wp-login.php -> /Users/joe/tmp/example.com/trunk-new/wp-login.php/ - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] strip per-dir prefix: /Users/joe/tmp/example.com/trunk-new/wp-login.php/ -> wp-login.php/ - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] applying pattern '^$' to uri 'wp-login.php/' - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] add path info postfix: /Users/joe/tmp/example.com/trunk-new/wp-login.php -> /Users/joe/tmp/example.com/trunk-new/wp-login.php/ - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] strip per-dir prefix: /Users/joe/tmp/example.com/trunk-new/wp-login.php/ -> wp-login.php/ - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (3) [perdir /Users/joe/tmp/example.com/trunk-new/] applying pattern '.*' to uri 'wp-login.php/' - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (2) [perdir /Users/joe/tmp/example.com/trunk-new/] rewrite 'wp-login.php/' -> '/wp-core/index.php'

Specifically: requested uri /wp-login.php/ indicates that Apache receives a request for /wp-login.php/ and not wp-login.php and mod_rewrite passes through the request.

Can anyone offer any suggestions on how I can set this up so that I can have WP core files in one directory in the doc root and wp-config/ alongside the WP core directory?


wp-login.php is an actual file that is directly loaded up instead of using a rewrite rule. If you look at file listing in /var/www/vhosts/www.example.com/, you'll probably will not see the wp-login.php file. But if you check /var/www/vhosts/www.example.com/wp-core/, you'll probably find it if I understand your configuration correctly. This means your login URL is actually: http://www.example.com/wp-core/wp-login.php

Now there is another issue with your current setup. WordPress doesn't know the URL to where the core files and hence the admin area of the site. By default, WordPress uses the same URL for the public side (home url) and the installation folder (site url). You can configure this in your wp-config.php file:

define( 'WP_SITEURL', 'http://example.com/wp-core' ); // Where the WP core is
define( 'WP_HOME', 'http://example.com/' ); // Where the public goes to view your blog
  • please correct me if I am wrong, but does the line RewriteRule ^$ /wp-core/index.php [L] not resolve the issue you describe of having to include /wp-core in the URL by rewriting the URL to the index.php file in /wp-core?
    – JoeNyland
    Feb 7 '14 at 7:21
  • No. /wp-core/index.php handles the front-end/public facing side of the site for pretty URLs. It does not handle the login or admin pages. Feb 7 '14 at 19:06
  • I understand that, however that was not what I meant, but I should have been clearer.
    – JoeNyland
    Feb 7 '14 at 19:26

By utilising the .htaccess file provided in the following link, I was able to access wp-login again, without redirecting to a URL with a trailing slash:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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