wordpress - .htaccess too many redirects. Redirect all users except ip to different part of website -


i'm trying make website users redirected specific part in domain can see "comming soon" page. while ip addresses can still access normal website can see how going look.

what i'm trying do: create wordpress website in root of public_html, create directory in public_html , redirect users except few ip's http://www.domain.com/soon/index.html

my .htaccess looks followed:

rewriteengine on rewritebase / rewritecond %{remote_host} !^1.2.3.4 rewriterule (.*) http://www.domain.com/soon/index.html [r=302,l] 

however whenever go website test out tells me: err_too_many_redirects

is there i'm doing wrong in .htaccess?

use rule very first rule in .htaccess:

rewriteengine on  rewritecond %{remote_addr} !^(1\.2\.3\.4|11\.22\.33\.44)$ rewritecond %{request_uri} !\.(?:jpe?g|gif|bmp|png|tiff|css|js)$ rewriterule !^soon/index\.html$ http://www.domain.com/soon/index.html [r=302,l,nc] 
  • variable remote_addr matches client's ip in web request.
  • rewritecond %{request_filename} !-f needed avoid redirecting css/js/image files , /soon/index.html file.

Comments

Post a Comment

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -