Installing WordPress for development without clobbering HTML website
Published on May 26, 2011
There are a lot of starting points for this procedure, and to a certain degree they all have to handled differently.
- Plain website using .html files
- Manually built website using PHP
- Site built in Joomla!, PHPNuke, Mambo or similar
<?php
/** BEGIN: Remove this section when you want the world
** to see the WordPress site.
**/
$use_wordpress = 0;
foreach (array_keys($_REQUEST) as $request) {
if (preg_match('/wordpress_logged_in/', $request)) {
$use_wordpress = 1;
}
}
if ($use_wordpress == 0) {
include("old-index.html");
exit;
}
/** Remove this section when you want the world
** to see the WordPress site.
END **/
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
?>
You can visit http://www.mysite.com/ and see your old website, as will all normal visitors.
If you visit http://www.mysite.com/wp-admin/ and log in, then go back to look at http://www.mysite.com/ you should see the WordPress site.