April 26, 2020
Estimated Post Reading Time ~

Create maintenance page in Apache Dispatcher

Creating Maintenance Page
Create a maintenance page say maintenance.html under document root (C:\Apache2\htdocs)
Create an empty file, named “maintenance.enable”, inside the site's document root (C:\Apache2\htdocs)
Redirect to Maintenance Page Using HTAccess create .htaccess file under C:\Apache2\htdocs
Copy below code in .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /maintenance.html [R=503,L]
ErrorDocument 503 /maintenance.html
Header Set Cache-Control "max-age=0, no-store"
</IfModule>

To disable the maintenance delete “maintenance.enable” file or rename it.



Troubleshooting Dispatcher
In httpd.conf,
a)Under <Directory "/Apache2/htdocs"> update below code
#AllowOverride None
AllowOverride All
#http://stackoverflow.com/questions/21551840/forbidden-you-dont-have-permission-to-access-on-this-server
#Order allow,deny
#Allow from all

<IfVersion < 2.4>
Allow from all
</IfVersion>
<IfVersion >= 2.4>
Require all granted
</IfVersion>

b) Under <Directory />

comment to avoid forbidden error => Deny from all


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.