• Hi

    I am using this code to try and redirect all visitors to a maintenance page but it doesn’t display any images.

    <Limit GET POST PUT>
    order deny,allow
    deny from all
    allow from 123.456.789
    allow from 123.456.789
    </LIMIT>
    ErrorDocument 403 /custom-message.html
    <Files custom-message.html>
    order allow,deny
    allow from all
    </Files>

    How can I modify the code to allow it to display the images on the maintenance page?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • You should try using something like this instead.

    Options +FollowSymlinks
    RewriteEngine on
    RewriteCond %{REMOTE_HOST} !^123\.45\.67\.89
    RewriteCond %{REQUEST_URI} !/custom-message\.html$
    RewriteRule \.html$ /alternate_page.html [R=302,L]

    You may still need to modify it to fit your specific needs.

    reference: http://www.webmasterworld.com/forum92/167.htm

    Thread Starter s0206

    (@s0206)

    Thanks Jonathan. I ended up using a plugin.

    I’d still be interested in getting it to work via htaccess so I’ll give this a try.

    🙂

    If the previous rules don’t help you could try this which is a bit simpler and uses %{REMOTE_ADDR} instead of %{REMOTE_HOST}. It also assumes that you are using/referencing an image.

    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} !^(123\.45\.67\.89|213\.45\.67\.89)
    RewriteCond %{REQUEST_URI} !/custom-message\.html$
    RewriteCond %{REQUEST_URI} !/custom-message\.png$
    RewriteRule .* /custom-message\.html [R=307,L]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘htaccess redirect all visitors except for certain IP address’ is closed to new replies.