0

I am attempting to redirect all users to a maintenance page, while only allowing myself to use the website. I currently have the redirect working, but cannot seem to allow myself to access the site. Here is the code I added to my .htaccess file:

# Maintenance Redirection
# Replace 555\.555\.555\.555 with your own IP address
# Uncomment first conditional to turn off the redirection
# RewriteCond %{REQUEST_URI} ^$a
RewriteCond %{REQUEST_URI} !maintenance.php
RewriteCond %{REQUEST_FILENAME} !(css|font).+$
RewriteCond %{REMOTE_ADDR} !^555\.555\.555\.555$
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$
RewriteRule (.*) /maintenance.php [R,L]

I replaced the area with 555\.555\.555\.555 with my own IP address. I should note that I retained the backslash, but I am assuming that is an escape sequence?

Thank you for the help in advance.

Nihir
  • 135
  • 1
  • 1
  • 11
  • I tried your code and it worked for me. Are you sure you indicate correctly your IP address? – Alexander Gelbukh Jul 14 '14 at 10:46
  • We tried two different IP addresses, not at the same time, and it didn't work. When we put our IP address in, we just replaced 5s with our IP address numbers. @AlexanderGelbukh – Nihir Jul 15 '14 at 02:06
  • Do you have `RewriteEngine on`? Try also inserting the following line: `RewriteRule (IP) /x%{REMOTE_ADDR}x [R,L]` and then see the webpage `your.server/your/dir/IP`. It should say `The requested URL /your/dir/x555.555.555.555x was not found on this server.` so that you will know exactly what's the server's idea of your IP is. – Alexander Gelbukh Jul 15 '14 at 03:03

0 Answers0