skip to Main Content

I want to show 503 error on a specific URL of my website. This should only apply to that specific URL and other pages should load fine. So far I’ve tried the following with no luck. Any help is appreciated. Thanks.

ErrorDocument 503 "Our website is temporarily closed for scheduled maintenance."
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !http://example.com/myspeicifcpage$
RewriteRule .* - [R=503,L]

2

Answers


  1. For your mentioned URLs you could try following, this will look for specific urls like http://localhost:80/ or http://localhost:80/a or http://localhost:80/b.

    ErrorDocument 503 /league.php
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/?$ [OR]
    RewriteCond %{REQUEST_URI} ^/(a|b)/?$ [NC]
    RewriteRule .* - [R=503,L]
    


    OR In case you want to get 503 for any page for domain name example.com then you could try following.

    ErrorDocument 503 /league.php
    RewriteEngine On
    RewriteCond %{HTTP_HOST} example.com [NC]
    RewriteRule .* - [R=503,L]
    
    Login or Signup to reply.
  2. You can use this :

    ErrorDocument 503 "Our website is temporarily closed for schedule maintenance"
    Redirect 503 /specificPage
    

    This will print the error text on /specificPage if it is accessed.

    You can also markup the error message using html tags

    ErrorDocument 503 "<b>Our website is temporarily closed for schedule maintenance.</b>"
    Redirect 503 /specificPage
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search