Jump to content

.htaccess help.


Err

Recommended Posts

Hi.This might seem like an elementary question, but I have to know. How can I redirect all the pages/directories on a site to a page on the same site called maintenance.html on the main directory? I'm using the .htaccess code: redirect / http://www.example.com/maintenance.html, of course that throws everything into an infinite loop, which then results in 403 error on the server I'm on. But how can I redirect to whole site to the maintenance.html page without this loop happening? Obviously I'm trying to display only the maintenance.html page when I'm working on the site. Help? :)

Link to comment
Share on other sites

Perhaps use a RedirectMatch instead. For example:

RedirectMatch temp \/(?!maintenance\.html$) /maintenance.html

should redirect all requests, except maintenance.html to maintenance.html, thus eliminating the loop.

Link to comment
Share on other sites

Thanks, but that didn't work on my server, I got a 500 error. :) Is there anything that'll do a similar thing to this? I also want to make note that I need to access the all the web pages, where as the visitor gets redirected. :)

Link to comment
Share on other sites

I didn't understood what else did you wanted. Example?As for the above... hmm.... perhaps a "?" before the group to indicate it's optional:

RedirectMatch temp \/?(?!maintenance\.html$) /maintenance.html

or were "?" placed after the optional character/group like

RedirectMatch temp \/(?!maintenance\.html$)? /maintenance.html

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...