Answer the question
In order to leave comments, you need to log in
How to make a 301 redirect for all IPs except your own?
There is a site that, for SEO, wants to make a 301 redirect from a domain with www to a domain without www.
At the same time, from the internal office network using split-DNS and raised on a Windows server, the site on the domain without www is not visible, a stub is shown (for the internal DNS group, mail is full there, etc.).
Since the problem with split-DNS and the office network is difficult to solve, I thought it would be easier to make a 301 redirect from www to without www for all visitors except from the office IP. Is it really easier? How is it written at the htaccess / mode_rewrite level?
Maybe what other solutions to this problem are possible?
Answer the question
In order to leave comments, you need to log in
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !1.2.3.4
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question