Search code examples
apache.htaccesshttp-redirectmod-rewriteurl-rewriting

How to Show a 503 Error for a Single Page


I want to show a 503 error for a page on my website. (Using htacess) So far I've tried the following but it seems to be not working.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /league.php [R=503,L]

Is this correct? Or is there anyway to give the absolute URL path? Thanks.


Solution

  • Could you please try following, tested and written with shown samples. Please make sure you clear your browser cache before testing your URLs.

    RewriteEngine ON
    RewriteCond %{REQUEST_URI} ^/webmail/?$ [NC]
    RewriteRule ^(.*)$ league.php [R=503,L]
    

    OR using errordocument option.

    ErrorDocument 503 /league.php
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/webmail/?$ [NC]
    RewriteRule .* - [R=503,L]