We're converting a domain for a client from hosting some demo content to hosting a WordPress site. In the process, we need to keep the previous URLs valid, but let WP provide the document-root. I also like to keep things organized, so WP will live in its own directory (/WP).
First, extract WordPress to the /WP directory, and update its configuration per the manual. Your life will be easier if you STOP before step 6 (install.php), and setup these rewrite rules first...
For this situation we have two .htaccess files.
One at the document root...
# /var/www/default/.htaccessRewriteEngine OnRewriteBase /# by default, /wp-admin redirects to the full# path to /wp-admin/ - in this case /WP/wp-admin/# which is BAD, and breaks login.# this rewrite preempts that by adding the# trailing slash, so that wp-admin goes directly# to login without the pathRewriteRule ^(.*)wp-admin$ $1wp-admin/ [R=302,L]# Shortcut for directory indexRewriteRule ^$ /WP/ [PT,L]RewriteRule ^/$ /WP/ [PT,L]# Pass all non-file queries to WordPressRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^(.*)$ /WP/$1 [PT]
And one for WordPress...
# /var/www/default/WP/.htaccess# managed by WP, essentially its default# BEGIN WordPressRewriteEngine OnRewriteBase /RewriteRule ^index\.php$ - [L]RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]# END WordPress
OK, you can now proceed with step 6 on the manual - install, without using /WP in the URL.
(2010-08-13: update for directory index shortcuts)