Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Google has indexed the IP address of my site rather than the domain, so now I'm trying to set up a 301 redirect that will redirect the IP address and all subsequent pages to the domain.

I currently have something like this in my .htaccess file (however don't think it's working correctly?):

RewriteCond %{HTTP_HOST} ^12\.34\.567\.890
RewriteRule (.*) (domain address)/$1 [R=301,L]

I've used various redirect checker tools and keep getting the message: "... not redirecting to any URL or the redirect is NOT SEARCH ENGINE FRIENDLY"

Am I doing something wrong or is there something else I should be trying?

share|improve this question

Something like this

RewriteCond %{HTTP_HOST} ^12.34.567.890$ 
RewriteRule ^(.*)$ http://example.domain.com/$1 [R=301,L]

If either the old or new url won't dereference, then usually the Google crawler complains.

share|improve this answer

Try this pattern for your httphost cond (the following represent the end of the first line)

!^example\.com [NC]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.