I've been stuck for a while now on how to create a "Coming Soon" page for my CakePHP site. I need to keep the webroot directory protected via .htpasswd so only authorised users can access the site whilst it's being built. However, regular visitors should be shown the "Coming Soon" page when they visit thesiteurl.com or thesiteurl.com/index.html. All authorised users will gain access to the rest of the site by visiting thesiteurl.com/index.php and entering the login credentials.
Here's the directory structure of the relevant files I think I need to edit to make this work.
/.htaccess
/comingsoon - directory containing images, css and js for the coming soon page
/index.html - the "Coming Soon" page
/index.php - the page authorised users use to access the site
/webroot/.htaccess
/webroot/index.php
Contents of .htaccess
DirectoryIndex index.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !/
RewriteCond %{REQUEST_URI} !/index\.html
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Contents of webroot/.htaccess
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/my/.htpasswd
AuthGroupFile /dev/null
require valid-user
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
These .htaccess rules just take me to the webroot directory file listing if I try to access thesiteurl.com and a blank page styled like the rest of my site if I access thesiteurl.com/index.html. thesiteurl.com/index.php will take me to the index page authorised users see once they log in however.
Any help would be much appreciated.