Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

htaccess redirect to maintenance page but not if they want a page inside of specific folders

Posted on 2012-03-26
1
Medium Priority
?
318 Views
Last Modified: 2012-04-15
Dear Experts,

I am needing to do a few updates on the public portion of my site and need to redirect traffic using htaccess to a maintenance page while I update the pages,  I don't really know where to begin. I am hoping it wont be to complicated but what I need to do is this:

redirect all traffic to a maintenance page called "update.php" unless they need access to a page inside of a folder called "cora" or "member". Also I would like to allow them access to the login and the logout page which is "login.php" and "logout.php"

Also I would still like to allow myself access to the site while I test to make sure the update is working correctly. So I would need to allow my ip address have access to everything.

Many thanks as always
0
Comment
Question by:Lightwalker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 51

Accepted Solution

by:
Steve Bink earned 2000 total points
ID: 37774938
Make sure you have mod_rewrite in your Apache installation.  You can see the docs for more information on the directives:

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

Something like this should work you:

RewriteCond %{REQUEST_FILENAME} !^/(cora|member)/ [NC]
RewriteCond %{REQUEST_FILENAME} !^/?log(in|out)\.php$ [NC]
# your ip goes on the next line
RewriteCond %{REMOTE_ADDR} !000\.000\.000\.000
RewriteRule ^/?(.*)$ update.php [L]

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question