Ask Your Question

Redirect users to maintenance page [closed]

asked 2014-03-13 08:15:58 -0500

KeithJ gravatar image

Hi Guys

ubuntu server. I am trying to implement a feature, whereby we can redirect the user to a static html page if we are performing any maintenance on Openstack.

I have mod-rewrite working in the .htaccess file in /var/www

.htacess file looks like the following:

RewriteEngine on RewriteRule ^/?index.html$ maintenance.html [L]

So now if I go to :

http:<ipaddress> instead of getting the index.html I get the maintenance html.

This tells me that the rewrite option is working correctly.

Ok Now where I am struggling is the actual address I need for the dashboard so that when somebody tries to access it, it points to my maintenance.html file rather than the dashboard. eg if my dashboard address is http: what do i need to put instead of index.html ?

RewriteRule ^/?index.html$ maintenance.html [L]

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by SamYaple
close date 2014-04-01 08:28:59.876219

2 answers

Sort by ยป oldest newest most voted

answered 2014-03-13 08:29:57 -0500

SamYaple gravatar image

updated 2014-03-13 08:33:54 -0500

On Ubuntu you will need to edit /etc/apache2/conf-available/openstack-dashboard.conf It is the same file in a slightly different location on RHEL.

Append this rule to the bottom of the file

RewriteEngine on
RewriteRule ^(.*)$ http://ipaddress_of_webserver/maintenance.html [R=302,L]

If you want only a few ip addresses to be able to access the site and not be redirected, modify the ip address below with the ip addresses you want to bypass the redirect rule.

RewriteEngine on
RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89
RewriteRule ^(.*)$ http://ipaddress_of_webserver/maintenance.html [R=302,L]

For those unaware of this syntax, RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89 means "Rewrite Condition matches everyone that does not equal"

If you are not running another website on the server, you can get horizon to show up on the root of the webserver by modifying the following files to match below.


WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi


edit flag offensive delete link more

answered 2014-03-13 09:09:43 -0500

KeithJ gravatar image

Hi Sam thanks for your answer.
I have also found that I can create a .htaccess folder in /usr/share/openstack-dashboard/openstack_dashboard/wsgi and redirect to /var/www/maintenance.html since my maintenance file is in /var/www or alternatively put my maintenace.html in that directory.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-03-13 08:15:58 -0500

Seen: 840 times

Last updated: Mar 13 '14