How to display a static HTML page while setting up a WordPress site?

I just installed WordPress. I have a non WordPress splash page at [root folder]/index.html. I’d like to keep the splash page up while I work on skinning WordPress. When I try to access index.php (also in the root folder), it rewrites the url to index.html. I don’t see index.html in the url but the splash page is there and I never see WordPress.

I am able to access the WordPress admin without issue. Anyone know how I can access WordPress without making it go live?

Related posts

Leave a Reply

5 comments

  1. Either use a plugin (like wp-maintenance-mode) or hardcode your .htaccess file to redirect to the splash page, and allow your own (or your team) IP address to ignore the redirect. Like this:

    <IfModule mod_rewrite.c>
    
    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !^127.0.0.1
    RewriteCond %{REQUEST_URI} !/splashpage.html$ [NC]
    RewriteRule .* /maintenance.html [R=302,L]
    
    </IfModule>
    

    Regarding your doubt why index.html gets served from root, it is because it usually takes precedence over index.php. If you wanted to change that, you would have to change the DirectoryIndex.

    EDIT: I thought it was obvious, but, for the sake of clarity: 127.0.0.1 should be changed to your public IP address. Also note that 302 is Temporary Redirect, which is what we want.

  2. Try this.

    function temp_page_redirect() {
        if (!current_user_can('administrator')) {
            wp_safe_redirect('temp.html',307);
        }
    }
    add_action('template_redirect','temp_page_redirect');
    

    I did not use index.html because because that file name has special significance to the server. The ‘307’ is a status code meaning temporary redirect. I assumed that the ‘administrator’ role needs access ๐Ÿ™‚

  3. I feel the easiest method of achieving this is editing the .htaccess file in the root web directory, and place this at the top:

    DirectoryIndex index.html index.php
    

    That swaps the priority order in which Apache chooses which file to use.

  4. This works perfectly. Add new plugin folder with this file as index.php.

    From the support thread:

    “To address the original question, you can turn off canonical redirection by putting this into your plugins directory รขย€ย“”

    <?php
    /*
    Plugin Name: Disable Canonical URL Redirection
    Description: Disables the "Canonical URL Redirect" features of WordPress 2.3 and above.
    Version: 1.0
    Author: Mark Jaquith
    Author URI: http://markjaquith.com/
    */ 
    
    remove_filter('template_redirect', 'redirect_canonical'); 
    
    ?>
    

    This seemed to help a lot of people there, and might be a proper answer here as well.

  5. Try this on your htaccess file:

    DirectoryIndex index.html index.php
    

    This code means that apache will look for index.html first, and if it doesn’t exist then will look for index.php