Note that there are some explanatory texts on larger screens.

plurals
  1. PO.htaccess rules for "Coming Soon" page on CakePHP site
    primarykey
    data
    text
    <p>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 <code>webroot</code> directory protected via <code>.htpasswd</code> 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 <code>thesiteurl.com</code> or <code>thesiteurl.com/index.html</code>. All authorised users will gain access to the rest of the site by visiting <code>thesiteurl.com/index.php</code> and entering the login credentials.</p> <p>Here's the directory structure of the relevant files I think I need to edit to make this work.</p> <pre><code>/.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 </code></pre> <p>Contents of .htaccess</p> <pre><code>DirectoryIndex index.html &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteCond %{REQUEST_URI} !/ RewriteCond %{REQUEST_URI} !/index\.html RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] &lt;/IfModule&gt; </code></pre> <p>Contents of webroot/.htaccess</p> <pre><code>AuthName "Restricted Area" AuthType Basic AuthUserFile /path/to/my/.htpasswd AuthGroupFile /dev/null require valid-user &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] &lt;/IfModule&gt; </code></pre> <p>These .htaccess rules just take me to the <code>webroot</code> directory file listing if I try to access <code>thesiteurl.com</code> and a blank page styled like the rest of my site if I access <code>thesiteurl.com/index.html</code>. <code>thesiteurl.com/index.php</code> will take me to the index page authorised users see once they log in however.</p> <p>Any help would be much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload