Many people have used Subversion to install WordPress or have installed WordPress into its own directory. You can combine these techniques to create a "clean" Subversion installation in which the user's custom files (wp-config.php and wp-content/) are stored outside of the WordPress application directory, so that user files and files under version control never overlap. (Original credit to Sam Bauers for presenting these instructions at WordCampUK.)
In the example below we will use wordpress as the directory for the core WordPress files and wordpress-content for the new location of the wp-content directory; the home directory will be the Document Root (http://example.com). The finished installation will include files in these locations:
/.htaccess /wordpress/ /wordpress/index.php /wordpress-content/ /wp-config.php
There are a few basic steps (explained in detail below):
Create the new location for the core WordPress files to be stored (we will use /wordpress in the examples).
Following the New Install using Subversion instructions, check out (Subversion command co) the stable version of WordPress you have chosen. Do not type the $ characters -- they are just indications of the command prompt. Here is the command (assuming the version you want is 6.6.2):
$ svn co http://core.svn.wordpress.org/tags/6.6.2 .
When the download is complete, edit the wp-config.php (see editing wp-config.php) ignoring the Advanced Options and save the file within the root directory (http://example.com/).
Access your blog URL (http://example.com/wordpress) to complete the installation, as in the standard WordPress installation instructions.
Change the Site address to the URL of the home directory. This can be done in the Settings panel or in wp-config.
(This method avoids the error message and is more easily reversible.)
Set the WP_HOME constant in wp-config like so:
define( 'WP_HOME', 'http://example.com' );
Instead of moving WordPress's index.php file into the home directory (as in Giving_WordPress_Its_Own_Directory), we leave it in the application directory and change the mod_rewrite rules to pass requests there.
Set up Permalinks on the Permalinks panel and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. Don't worry if WordPress can't write to your .htaccess file; we will be overwriting the contents anyway.
If the file exists move the .htaccess file from the wordpress directory into the root directory of your site (Blog address).
Open your root directory's .htaccess file in a text editor (or create it if necessary).
Edit the contents of the file to match the following lines, using your directory name for the WordPress core files:
# 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 ^$ /wordpress/index.php [L] # Skip real files and directories RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # Otherwise send it to WordPress RewriteRule .* /wordpress/index.php [L] </IfModule> # END WordPress
Edit the .htaccess file permissions to ensure WordPress can't overwrite it.
Note: If working in your development environment on a Windows machine (e.g. using XAMPP), file permissions can be modified by: right-click => Properties => 'Security' tab.
You should now be able to view the site via the root URL (http://example.com).
Create the new location for the wp-content directory (we will use /wordpress-content in our examples).
In that directory create two further directories called plugins and themes.
Edit the wp-config.php adding the following lines:
define('WP_CONTENT_DIR', dirname(__FILE__) . '/wordpress-content'); define('WP_CONTENT_URL', 'http://example.com/wordpress-content');
Create soft links of wp-content/plugins/akismet/ into wordpress-content/plugins/ and wp-content/themes/default/ into wordpress-content/themes/. This will ensure that WordPress uses any SVN updates to the default theme or Akismet plugin. Running XAMPP on a Windows machine, you can follow these instructions for creating symlinks: http://www.inkplant.com/code/how-to-create-a-symbolic-link-in-windows-vista.php