htaccess put site into maintenance, deny all but my own IP

.htaccess, ip

Solution

Found the solution that worked for me.

RewriteEngine On
RewriteBase /

#ip is not your ip. Change ip to see maintenance page
RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$

#requests made not to maintenance.php ... 
RewriteCond %{REQUEST_URI} !^/maintenance\.php$

#rewrite to maintenance.php
RewriteRule ^(.*)$ /maintenance.php [L]

Problem

I want to put my webpage into maintenance so I replace my original htaccess file with this: ``` ErrorDocument 403 /maintenance/maintenance.php order deny,allow deny from all allow from 111.222.333.444 ``` Have read a lot of threads before posting and this is what i gathered would be the correct solution, but I don´t get it to work. If I don´t allow from my own IP I get an Error 500 (meaning that that is what my visitors would see) and if I do use my IP I get and Error 403 (and I dont even reach my maintenance page it sais I´m not allowed there either). What am I doing wrong here? Thanks in advance.

Original source