views:

17

answers:

1

I'm deploying a Wordpress blog, but I don't want to overwrite the current site yet.

public_html/. <-- the current site

public_html/wp/. <-- the new site

How must my .htaccess look like so I can seamlessly switch from the current site to the new one so that http://domain.tld shows the new site like it would be directly in the public_html folder

+1  A: 

I don't know whether it applies to your situation, but wouldn't it be simpler to just do a series of move operations in your FTP client?

  1. Create directory /public_html/old/
  2. Move everything except for /public_html/wp into /public_html/old
  3. Move everything from /public_html/wp up one level

done!

You'd have to be very careful when doing the moving of course.

If that won't work, I don't know what kind of hosting environment you are in, but the easiest way to do would be to map your domain to public_html/wp instead of public_html. That can't be done in .htaccess though, you will need some kind of access to the site's setup.

In .htaccess, you will probably have to use a mod_rewrite rule that could look something like this (I can't test this right now so no guarantees.)

RewriteCond %{REQUEST_URI} !^/wp
RewriteRule (.*) /wp/$1?%{QUERY_STRING}
Pekka
that would work as well, but thought a rewrite makes switching easier
Midday
@Midday I added a (untested) rewrite.
Pekka
@Midday I would prefer moving in any case because it's cleaner. Rewrite rules make things harder to maintain, you may get in trouble with absolute paths in your new WP config, and cost a bit of performance.
Pekka