Redirecting does not work properly, htaccess ignore my IP

here my htaccess

RewriteEngine On
RewriteBase /

# Rewrite non-www to www
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Rewrite HTTP to HTTPS:
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Rewrite to comingsoon
RewriteCond %{REMOTE_ADDR} !=
RewriteCond %{REQUEST_URI} !/comingsoon\.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|css|js) [NC]
RewriteRule .* /comingsoon.html [R=302,L]

The visitor with correct IP will ignored and redirected. What is wrong with the code, does someone notice what?

Thanks in advance.

1 answer

  • answered 2017-06-17 18:33 satriani

    OK that make a trick RewriteCond %{HTTP:X-FORWARDED-FOR} !=