I have a specific folder for which I want to trigger a 503 response (maintenance). The rest of my website should be accessible.
can this be easily done in htaccess?
I browsed the web but can only find information on how to do it for the whole website.
ErrorDocument 503 /503.php
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !/503.php$ [NC]
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$
RewriteRule .* - [R=503,L]
PS: I also tried to find a more general tutorial on htaccess and this type of stuff so I can learn the basics and figure out things myself. But all I found was snippets and snippets and more snippets. Any suggestions?
You need to just place above code in /folder/.htaccess
where you want to show 503 custom page. Otherwise your code looks fine. Just make sure /503.php
exists.