Search code examples
apache.htaccesshttp-redirecthttp-status-code-503

How to keep website url the same in .htaccess 503 redirect


I have a .htaccess file and i've set up a 'Coming Soon' website. It excludes my ip as i'm the developer but for other visitors I don't wan't it to change the url of the address.

Here's the file:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^12.345.67.89$
RewriteCond %{REQUEST_URI} !/HTML/pages/construction.html
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|css|ico|mp4) [NC]
RewriteRule ^(.*)$ /HTML/pages/construction.html [R=302,L]

ErrorDocument 404 /HTML/error-pages/404.html

How can I do this? Help is very much appreciated


Solution

  • If you don't want to change the URL then simply remove the redirect flag from your RewriteRule .

    Do the following :

    Change

    RewriteRule ^(.*)$ /HTML/pages/construction.html [R=302,L]
    

    To

    RewriteRule ^(.*)$ /HTML/pages/construction.html [L]