Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having issue in the last line of the below code which is causing the redirect loop (at least that's what i think so)

RewriteEngine On
RewriteBase /jgel/
RewriteCond %{REMOTE_ADDR} !^172\.172\.121\.142
RewriteCond %{REQUEST_URI} !maintainance\.php
RewriteCond %{REQUEST_URI} !resources/(.*)$ [nc]
RewriteRule ^(.*)$ maintenance.php [R=307,L]

I have tried this and this too doesn't work

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^172\.172\.121\.142
RewriteCond %{REQUEST_URI} !maintainance\.php
RewriteCond %{REQUEST_URI} !resources/(.*)$ [nc]
RewriteRule ^(.*)$ /jgel/maintenance.php [R=307,L]
share|improve this question
    
Have you tried with R=302? –  Mathias R. Jessen Mar 18 '12 at 18:13
    
Can you provide the response header that you're getting from the server, and maybe the contents of a RewriteLogFile with RewriteLogLevel 9 set? –  Shane Madden Mar 18 '12 at 18:30
add comment

1 Answer

up vote 0 down vote accepted
RewriteEngine On
RewriteBase /jgel/
RewriteCond %{REQUEST_URI} !maintainance\.php$
RewriteRule ^(.*)$ maintainance.php [R=307,L]

This should do what you need ; you can add other two conditions if you want but this is minimum working example, I've tested on Apache 2.2.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.