How to redirect to a maintenance page?

Discussion in 'General' started by jwlinux, Nov 22, 2010.

  1. jwlinux

    jwlinux New Member

    Hello,
    I'm having trouble figuring out how to redirect to a maintenance page.

    I have tried various combinations of all of the following code in the "Options" under the site and all of them create an infinite redirect loop. Most of the pages on the site are php.


    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !/error/site_under_maintenance.html$
    RewriteCond %{REMOTE_HOST} !^12\.222\.222\.22
    RewriteRule $ /error/site_under_maintenance.html [R=307,L]


    RewriteEngine On
    RewriteBase /
    # If the request is NOT for /maintenance.php, send /maintenance.php instead.
    RewriteCond %{REQUEST_URI} !^/error/site_under_maintenance\.html$
    RewriteRule ^(.*)$ /error/site_under_maintenance\.html [L]



    RewriteEngine on
    RewriteCond %{REQUEST_URI} !/error/site_under_maintenance\.html$
    RewriteCond %{REMOTE_HOST} !^12\.222\.222\.22
    RewriteRule $ /error/site_under_maintenance\.html [R=307,L]


    RewriteEngine on
    RewriteCond %{REQUEST_URI} !/error/site_under_maintenance\.html$
    RewriteCond %{REMOTE_HOST} !^12\.222\.222\.22
    RewriteRule $ /error/site_under_maintenance.html [R=307,L]


    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !^12\.222\.222\.22
    RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
    RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
    RewriteRule .* /maintenance.html [R=307,L]

    The page does exist in both places, BTW.

    Can anyone tell me the correct way to redirect to a maintenance page? Hopefully while still allowing access from the admin IP address.

    Thanks,

    JW
     
  2. jwlinux

    jwlinux New Member

    Nevermind, this was classic user error on my part. This works:


    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !^12\.2222\.222\.22
    RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
    RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|php|css|js) [NC]
    RewriteRule .* /maintenance.html [R=307,L]
     
  3. jwlinux

    jwlinux New Member

    I will add this question:

    In the admin area for a site, there is a section (tab) called redirect. I don't understand how that's supposed to be used ... could someone provide some examples?
     
  4. falko

    falko Super Moderator ISPConfig Developer

    This is from the ISPConfig 3 Manual:

     

Share This Page