Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1092017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:37:10+00:00 2026-05-16T23:37:10+00:00

I’ve been stuck for a while now on how to create a Coming Soon

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:37:11+00:00Added an answer on May 16, 2026 at 11:37 pm

    The cake way would be to put the public access files into app/views/pages.

    1. Set up auth (it’s easy and if you
      haven’t already learnt it, you’ll
      need to sooner or later) to give
      login access to controller
      functions. See http://book.cakephp.org/view/172/Authentication

    2. If you haven’t done it already, copy
      the pages controller from
      cake/libs/controller into
      app/controllers. Make sure that the
      before filter in PagesController
      reads something like:

      function beforeFilter()
      {
          parent::beforeFilter();
          $this->Auth->allowedActions = array('display');
      }
      

      See
      http://book.cakephp.org/view/854/The-Pages-Controller

    3. Clean that htaccess hocus back to
      what was delivered with cake – it’s only going to cause you problems later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.