2

So I did a search engine optimization test today and one thing it came back with was:

Your site's IP XX.XXX.XXX.XX does not redirect to your site's domain name. This could cause duplicate content problems if a search engine indexes your site under both its IP and domain name. Consider using a 301 re-write rule in your .htaccess file so that your site's IP points to your domain name."

I have looked but I can't seem to find a clear answer on how to do this, I need to know what I would put into the .htaccess file? There was something over at Stack Overflow but I'm not sure that's right.

  • Did any of the answers help you? – Scott Helme Dec 17 '13 at 7:39
2

This warning is innocuous since IP addresses can serve multiple hosts and are not expected to redirect to one particular domain.

Prior to being concerned with this, you should first check if accessing the IP address even returns the same content as your domain. Even if it does however, search engines like Google will not penalize your site for duplicate content unless it appears to be spammy (e.g., intentionally scraping site content from another site), as indicated here:

Cutts on similar website content, multiple domains: Duplicate or safe?

  • 2
    I saw the "SEO tool" in question linked from reddit. It was full of incorrect advice so should not be trusted. – DisgruntledGoat Dec 16 '13 at 12:49
1

You probably want something like this depending on what your canonical URL is:

Options +FollowSymLinks
RewriteEngine on
# Redirect IP/non-canonical domains
RewriteCond %{HTTP_HOST} ^example\.com [OR]
RewriteCond %{HTTP_HOST} ^11\.22\.33\.44 <-- Server IP here.
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

You may already have something similar in your .htaccess if you redirect www -> non-www or vice versa.

edit - please remove the <-- Server IP here once you insert your own server IP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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