Solved

.htaccess to 'CLOSE' my website

Posted on 2003-11-18
1
221 Views
Last Modified: 2010-03-04
here is an extract of my .htaccess file which I use to close my website down.

This is controlled througha  PHP script which re-writes the file at the click of a link e.g. on the admin page I can click 'Close' to shut teh website down for maintenence/update etc.

=====
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !down\.php [NC]
RewriteRule ^(.+) http://something.com/error/down.php [R]
=====

However, this obviously redirects access to any page to the error document.

What I would like to do, is exclude the 'admin directory' from this redirect so that i can still login to admin to 'OPEN' the website again.

If i've been unclear just ask.

Thanks in advance
0
Comment
Question by:russelldav
[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 17

Accepted Solution

by:
dorward earned 125 total points
ID: 9779235
Untested, but I think this will do the job

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !down\.php [NC]
RewriteCond %{REQUEST_URI} !admin$ [NC]
RewriteRule ^(.+) http://something.com/error/down.php [R]
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

Title # Comments Views Activity
How can I write .htaccess code to redirect 301 pages? 1 141
linux apache localhost dev laptop 5 54
AWS EC2 HTTP & HTTPS 2 117
Certificate Request CentOS/Apache 1 57
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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