PrestaShop Documentation, PrestaShop Tutorials

Prestashop how to put the website in maintenance mode and allow access to specific IP addresses

In PrestaShop, you can put the website in maintenance mode and allow access to specific IP addresses by editing the settings files and creating a maintenance .htaccess file. Here’s how:

Log in to your hosting account and navigate to the directory where PrestaShop is installed.

Open the “config/settings.inc.php” file located in the root directory of your PrestaShop installation.

Find the following line of code:

sql

define(‘_PS_MODE_DEV_’, false);

Change “false” to “true”

sql

define(‘_PS_MODE_DEV_’, true);

Save the changes to the settings.inc.php file.

This will put your site in maintenance mode. You will see a message on the front end that the site is under maintenance.

Create a new .htaccess file in the root directory of your PrestaShop installation, and add the following code to it:

perl

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !^/maintenance\.html$ [NC]
RewriteRule ^(.*)$ /maintenance.html [R=302,L]

Replace the IP address 123.456.789.000 with the IP addresses you want to allow access to the site. You can add multiple IP addresses by separating them with a pipe (|) symbol.

Save the changes to the .htaccess file

This will redirect all users except those with the specified IP addresses to the maintenance.html page. You should create a maintenance.html file in the root directory of your PrestaShop installation, this page will be shown to anyone that is not allowed to access the site.

Note:

This is intended for development purposes, and it should be turned off on a live site.
It is also recommended to back up your site before making any changes.
Keep in mind that this process may affect the performance of your site, so make sure to check the site after the process and make any necessary adjustments.

This process is useful when you need to perform maintenance on your site, but you still want to give some access to your team or other people, for example, for testing purposes. Putting your site in maintenance mode will redirect your visitors to a page that says that the site is under maintenance and it will allow access to specific IP addresses to access the site while it’s in maintenance mode.

About zohaibk

We develop useful addons for #E-Commerce and #CRM software to provide extra features.#PrestaShop,#Magento,#SugarCRM,#Vtiger & #Android #apps
View all posts by zohaibk →