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:
/var/www/vhosts/www.example.com/wp-core/
/var/www/vhosts/www.example.com/wp-content/
/var/www/vhosts/www.example.com/wp-config.php
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';
home,http://www.example.com
SELECT option_name,option_value FROM wp_options WHERE option_name = 'site url';
siteurl,http://www.example.com
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]
</IfModule>
# 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:
127.0.0.1 - - [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/
127.0.0.1 - - [06/Feb/2014:21:02:59 +0000] [www.example.com/sid#7ffb79860180][rid#7ffb7b8020a0/initial] (1) pass through /wp-login.php/
127.0.0.1 - - [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/
127.0.0.1 - - [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/
127.0.0.1 - - [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/'
127.0.0.1 - - [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/
127.0.0.1 - - [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/
127.0.0.1 - - [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/'
127.0.0.1 - - [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 thewp-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 yourwp-config.php
file: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:http://ottopress.com/2011/creating-a-wordpress-site-using-svn/