Solved

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

Posted on 2012-03-26
1
315 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 50

Accepted Solution

by:
Steve Bink earned 500 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
What You Need to Know when Searching for a Webhost Provider
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 is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

740 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