Hide Site from Visitors

From Phoenix User Guide
Back
FAQ Tips & Tricks

There are times when it may be required to hide the site from visitors.

For examples, a new installation which is not yet ready, a test site which is not for public view or an existing live site that requires maintenance.



It is better to inform the public and search engines that existing live sites are down for maintenance temporarily and they should visit again.

This does both.

503 REDIRECT


Create a new .php file named 503 and add:

    <?php
      header("HTTP/1.1 503 Service Temporarily Unavailable");
      header("Status: 503 Service Temporarily Unavailable");
      header("Retry-After: 3600"); // This tells the search engines the number of seconds to wait before revisiting if they crawl your pages during maintenance
    ?>
    <html>
      <head>
        <meta charset="utf-8">
        <title>Your Shop Name</title>
          <style type="text/css">
            body,td,th { color: #000; font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px;}
            body { background-color: #FFFFFF; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;}
            h1 { font-size: 30px; color: #000;}
            h2 { font-size: 18px; color: #000;}
            div{ margin-top:50px; text-align:center;}
          </style>
      </head>
      <body>
        <div>
          <h1>Your Shop Name</h1>
          <p>We are currently performing maintenance on our site.</p>
          <p>This should be finished soon so please check again in an hour.</p>
          <p>Apologies for inconvenience, thanks for patience.</p>
        </div>
      </body>
    </html>


Change text and styles as required, save and upload the file to your server.


  • Then add the following to the top of the .htaccess file in your root folder/directory where your shop files are and save.
   # redirect to maintenance page
   # RewriteEngine on
   # RewriteCond %{REMOTE_ADDR} !^111.111.111.111
   # RewriteCond %{REQUEST_URI} !/503.php$ [NC]
   # RewriteRule .* /503.php [R=302,L]
  • Line 1, # redirect to maintenance page is just a memo stating what the following lines do.
  • Line 3, # RewriteCond %{REMOTE_ADDR} !^111.111.111.111 - change 111.111.111.111 to your IPV4 address (internet search for it) to allow you to access site.
  • Line 4, # RewriteCond %{REQUEST_URI} !/503.php$ [NC] and Line 5, # RewriteRule .* /503.php [R=302,L] - change /503.php in both of these lines to reflect the root of your shop e.g. /catalog/503.php
  • The # deactivates the line so delete # at start of lines 2,3,4,5 to activate so it looks like this:
   # redirect to maintenance page
   RewriteEngine on
   RewriteCond %{REMOTE_ADDR} !^111.111.111.111
   RewriteCond %{REQUEST_URI} !/503.php$ [NC]
   RewriteRule .* /503.php [R=302,L]

Add them again to deactivate, clear browser cache if 503.php page persists when deactivated.




New installations and test sites can be hidden behind a password wall.

PASSWORD PROTECT

Important - Immediately after installation:

  • Password protect the folder/directory to make sure the contents cannot be found by the public or internet search engines.

This can be done in the control panel on some host servers or do it yourself.

  1. Edit the .htaccess file which will be in the folder/directory where you installed CE Phoenix on the server.
  2. Copy and paste the following code at the bottom of the file - you need to replace /path/to/ with the root path of your shop (this can be found in includes/configure.php in the line that starts with const DIR_FS_CATALOG) and save.
AuthType Basic
AuthName "My Protected Area"
AuthUserFile /path/to/.htpasswd
Require valid-user
  1. Create a new text file.
  2. Open it and click Save as - select All types (*.*) next to file type - type the filename .htpasswd and click Save.
  3. Go to https://www.htaccesstools.com/htpasswd-generator/

Follow the instructions there i.e. enter a username and password (save these) and it will generate some code similar to this example - don't use this example!

Username:$apr1$OHIaiR2w$n6GlyntvlbKYE4.0veal1
  1. Copy and paste the code into the .htpasswd file and save.
  2. Upload the file to the folder/directory.

When the site is accessed something like this will be seen to sign in:

Signin.png



Phoenix User Guide is a continuing work in progress.
If you have any suggestions for content correction, improvement or inclusion please email us:
Contact.png
not a clickable link to prevent spam

Phoenix Cart User Guide, like CE Phoenix Cart, is free to use but is maintained by unpaid volunteers.
If you have found it useful, please donate to the coffee pot!
Use this link to donate whatever you want.

Donate with Paypal

"Phoenix" and the Phoenix Logo are copyright G. Burton.
Code references are licensed under a Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.
All other content is the reserved Intellectual Property and Copyright of phoenixcart.org
PROTECTED BY COPYSCAPE ANTI-PLAGIARISM
uk-unlimited-728x90.gif