Difference between revisions of "Hide Site from Visitors"
PeterRobert (talk | contribs) |
PeterRobert (talk | contribs) |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | < | + | <div class="btn btn-grey btn-back">{{#fas:arrow-left}} Back</div> <div class="btn btn-grey btn-faq">{{#fas:question-circle}} FAQ Tips & Tricks</div> |
| − | |||
<hr> | <hr> | ||
| Line 10: | Line 9: | ||
| − | It is better to inform the public and search engines | + | 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. | This does both. | ||
| Line 51: | Line 50: | ||
Change text and styles as required, save and upload the file to your server. | 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 | # redirect to maintenance page | ||
| Line 74: | Line 72: | ||
Add them again to deactivate, clear browser cache if '''503.php''' page persists when deactivated. | Add them again to deactivate, clear browser cache if '''503.php''' page persists when deactivated. | ||
| + | |||
| + | ---- | ||
| Line 87: | Line 87: | ||
#Edit the '''.htaccess''' file which will be in the folder/directory where you installed CE Phoenix on the server. | #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 | + | #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. |
<pre> | <pre> | ||
AuthType Basic | AuthType Basic | ||
Latest revision as of 06:06, 25 March 2021
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.
- 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 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
- 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:
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
