Difference between revisions of "Hide Site from Visitors"
PeterRobert (talk | contribs) |
PeterRobert (talk | contribs) |
||
| Line 50: | Line 50: | ||
<BIG>'''503 REDIRECT'''</BIG> | <BIG>'''503 REDIRECT'''</BIG> | ||
| − | Add to top of .htaccess | + | *Add the following to the top of the '''.htaccess''' file in your root folder/directory where your shop files are. |
| + | *'''# redirect to maintenance page''' is just a memo stating what the following lines do. | ||
| + | , change IP number in line 3 to your IPV4 address (google it) to allow you to access site, change /503.php to reflect root e.g. /catalog/503.php, delete # at start of lines 2,3,4,5 to activate, add them again to deactivate, clear browser cache if 503.php page persists when deactivated): | ||
# redirect to maintenance page | # redirect to maintenance page | ||
# RewriteEngine on | # RewriteEngine on | ||
| − | # RewriteCond %{REMOTE_ADDR} !^ | + | # RewriteCond %{REMOTE_ADDR} !^111.111.111.111 |
# RewriteCond %{REQUEST_URI} !/503.php$ [NC] | # RewriteCond %{REQUEST_URI} !/503.php$ [NC] | ||
# RewriteRule .* /503.php [R=302,L] | # RewriteRule .* /503.php [R=302,L] | ||
Revision as of 08:21, 5 September 2020
<historylink type="back">🠈 Back</historylink> 🠉 FAQS 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.
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.
- Edit the .htaccess file which will be in the folder/directory where you installed CE Phoenix on the server.
- Copy and paste the following code at the bottom of the file - you need to replace /path/to/ with the root path that you saved during How to Install at step 11 and save.
AuthType Basic AuthName "My Protected Area" AuthUserFile /path/to/.htpasswd Require valid-user
- Create a new text file.
- Open it and click Save as - select All types (*.*) next to file type - type the filename .htpasswd and click Save.
- 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
- Copy and paste the code into the .htpasswd file and save.
- Upload the file to the folder/directory.
When the site is accessed something like this will be seen to sign in:
It is better to inform the public and search engines on existing live sites that are down for maintenance.
This does both.
503 REDIRECT
- Add the following to the top of the .htaccess file in your root folder/directory where your shop files are.
- # redirect to maintenance page is just a memo stating what the following lines do.
, change IP number in line 3 to your IPV4 address (google it) to allow you to access site, change /503.php to reflect root e.g. /catalog/503.php, delete # at start of lines 2,3,4,5 to activate, add them again to deactivate, clear browser cache if 503.php page persists when deactivated):
# 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]
Create 503.php page 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>Heather Bell Honey Bees - Beekeeping Supplies</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>Heather Bell Honey Bees - Beekeeping Supplies</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>
Phoenix Cart User Guide, like CE Phoenix Cart, is free to use but is maintained by unpaid volunteers.
All other content is the reserved Intellectual Property and Copyright of phoenixcart.org
