Security and SSL
Show a temporary notice by replacing the index file
To temporarily show a notice when people visit the home page, you can replace the website's index file.
First keep a copy of the original index.php or index.html outside all public directories, where it cannot be downloaded over the web. Then create a new index with the notice you want to show.
This method does not block access: visitors can still request static files, routes that do not go through the index, APIs or other PHP scripts. Nor does it contain an intrusion or stop scheduled tasks or outgoing email.
If you really need to restrict a website during maintenance work, use HTTP authentication or access rules and check the result. To revert the notice, delete the temporary index and restore the original's name and permissions.
Choose the method for your goal
If you only want a notice on the home page, check which file actually serves /: the server may give priority to index.html, or the application may use its own rules. Keep the original without leaving a public index.php.bak, which could display code as text.
For general temporary unavailability, use a maintenance mode that returns HTTP 503 and check its scope. An empty page with a 200 response may be treated as the website's normal content. If you need to prevent access to documents, use username and password protection or a suitable restriction and test direct URLs too.
You may also find useful
- Imunify360: check detections and understand its limits Describes Imunify360's layers for blocking attacks and malware, the actions available in cPanel and...
- ModSecurity: investigate blocks and false positives Explains how the WAF blocks requests using rules, how to investigate a false positive and why a spec...
- Restrict PHP functions without breaking your application Explains where to restrict sensitive PHP functions from cPanel, gives a reference list and reminds y...
- Restrict the Magento admin by IP Provides an .htaccess rule to limit the Magento admin to exact IPs and explains its limits with prox...
Something wrong or out of date? Tell us and we will review it.