Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,098
    Thanks
    297
    Thanked 12 Times in 12 Posts

    htaccess to set a full website redirect to an "under maintenance" page

    Hi All

    I have a friend who wants me to redesign their website as it currently holds incorrect information, the best way i though of doing this is to have a full site redirect to a "website under maintenance" using the .htaccess file

    so no matter which page the user trys to access it will always redirect to the maintenance.php page

    can anyone help me with this please?
    thanks

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    Cornwall
    Posts
    2,098
    Thanks
    297
    Thanked 12 Times in 12 Posts
    ok i've got it working

    Code:
    # MAINTENANCE-PAGE REDIRECT
    <IfModule mod_rewrite.c>
     RewriteEngine on
     RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
     RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
     RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
     RewriteRule .* /maintenance.html [R=302,L]
    </IfModule>
    seems to work, but how do i prevent the full url from being displayed in the address bar, every pge redirects to www.mywebsite.com/maintenance.html but i dont want to show the /maintenance.html part how do i go about doing that please?

    also i dont want google to crawl just the maintenance page but all of the other pages too is this possible?

    many thanks
    Luke
    Last edited by LJackson; 10-03-2012 at 08:11 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •