Redirect IP Requests to Domain URLs & Fix IP Canonical Issues

Have you ever typed an IP address into your browser and still reached a website? What sorcery is this! The domain name we are all familiar with is simply a human-friendly pointer mapped to the website‘s unique identifying IP address in the background. This article will cover the critical SEO implications of having a website accessible through both avenues and how to properly handle the redirect to avoid duplicate content penalties.

What is an IP Address?

An IP address consists of a series of numbers separated by dots, such as 192.168.1.1. This uniquely identifies a server on the internet so requests can get routed to the exact location:

IP address example

Without getting too technical, just know that this address helps traffic find its way to the appropriate destination server.

What is a Domain Name?

Domain names like example.com make it much easier for end users to access websites. Behind the scenes, a domain name resolves to the hosting provider‘s unique IP address through a DNS lookup.

So entering a domain triggers a request first to the DNS server to fetch the IP address mapped to that domain. The browser can then send the user‘s request to the right location based on the IP address it received.

This makes the human experience of remembering example.com far simpler than having to recall complex strings of numbers!

The Problem of Accessing Websites by IP

As mentioned earlier, websites are essentially reachable through both the domain name as well as directly via IP address.

So what‘s the issue if the IP just points back to the domain website anyway?

Well, there are two potential problems this causes:

  1. Duplicate Content Penalties: Search engines can accidentally index the content twice – once under the domain page and once when crawled via the IP. This duplication can trigger penalties due to algorithmically generated pages.

  2. Equity Split: The equity and rankings power get divided across the IP and domain versions rather than consolidating all the linkage power to the domain URL. This dilution of equity can drastically impact search visibility and traffic to the website.

Let‘s expand on each risk…

Duplicate Content Penalties Explained

Industry research indicates over 75% of SEO professionals have faced duplicate content penalties at some point from search engines:

Duplicate content SEO penalties

Google and other search engines have advanced algorithms in place to detect duplicated website content and mark this as spam or auto-generated content.

Penalties for such duplication include:

  • Lower search rankings
  • Being removed entirely from the index
  • Traffic drops over time

This is because machines have a tough time understanding whether duplicated content is produced organically or simply copied without value. To avoid rewarding sites that duplicate, search engines blanket apply penalties as updates roll out.

Here are some user reactions seeing impacts of a duplicate content penalty first hand:

Google duplicate content penalty reactions

As you can see, traffic and revenue takes a big hit!

Now over time, search engines would figure out the IP address duplication and eventually may consolidate equity and rankings fully to the domain URL.

But why even risk months or years of traffic loss and instability?

The Split Equity Problem

The duplicate content risk we just discussed affects search visibility and rankings velocity long term. But IP addresses cause another problem – they fracture the equity already accumulated by the domain URL.

You see, all of the external websites linking to your content matter a great deal in SEO. Each link passes authority and rankings power to your pages.

Normally as more sites link to your domain home page for example, the higher it may rank for branded searches.

However, if third party sites start linking to both your domain URL and IP address separately, this divides the number of backlinks accrued:

Domain vs IP backlinks example

Rather than having 100 strong links consolidating all authority to the domain, it splits between the domain and IP with 50 links each pointing to both.

This will directly impact search visibility and opportunity traffic levels month over month.

So beyond duplicate content risks, mishandled IP addresses split your equity damaging organic growth.

Best Practice: 301 Redirect IPs to Domain

The most effective approach used by SEO experts worldwide is to set up a permanent 301 redirect from the IP address to the domain URL.

A 301 redirect means:

  • The IP URL is permanently moved to the domain URL
  • All link equity gets transferred to the domain URL
  • Search engines update their indexes with the new location

This is also called IP canonicalization – meaning the domain URL serves as the one canonical or authoritative location search engines should index while the IP redirects there.

Let‘s go through exactly how to test if your IP address is properly redirecting. Then I‘ll share step-by-step guides to fix this both on Nginx and Apache server environments.

How to Test IP Canonicalization

Manually navigate to your website IP address instead of the domain to check if it properly redirects:

http://123.123.123.123

You should immediately get redirected to the domain URL with a 301 Moved Permanently status if setup properly:

301 redirect working

However, if you see website content served directly from the IP, that indicates there is no redirect in place.

Alternatively, you can use online redirect checker tools:

1. Ahrefs Site Explorer

Ahrefs will crawl your site and explicitly check IP vs domain redirects as part of its detailed technical SEO audit.

Simply enter your URL here:

Ahrefs site explorer

The issue will get flagged under the Indexability section:

Ahrefs duplicate content

2. ScreamingFrog SEO Spider

ScreamingFrog is a desktop web crawler that generates detailed SEO reports and highlights detected issues.

Once again, IP canonical errors get flagged automatically as seen below:

Screamingfrog IP canonicalization

Both tools also allow you to manually trigger a crawl of the IP address itself to check redirect status.

Fixing IP Canonicalization in Nginx

If you identified redirection issues from your IP to domain, here is exactly how to fix this in Nginx:

  1. Login to your Nginx server shell:
ssh [email protected]
  1. Backup your main Nginx config file before making changes:
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
  1. Open the nginx.conf file:
nano /etc/nginx/nginx.conf
  1. Add your IP address and domain name to a new server block:
server {
  server_name 123.123.123.123; 
  return 301 http://www.example.com$request_uri;  
}

Breaking down key parts:

  • server_name – Your actual IP goes here
  • return 301 – Enables a permanent 301 redirect
  • http://www.example.com$request_uri – Your domain + path
  1. Save changes and restart Nginx:
service nginx restart

That‘s all you need to seamlessly redirect all requests from your IP over to your domain!

Let‘s move on to handling this in Apache servers now.

Fixing IP Canonicalization in Apache

If your website runs on Apache servers instead, here are the steps to properly redirect your IP:

  1. Login to your Apache server shell

  2. Backup httpd.conf file before editing:

cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
  1. Enable the mod_rewrite Apache module if not already active by removing comment signs:
LoadModule rewrite_module modules/mod_rewrite.so
  1. Add the following redirect rule either in .htaccess or directly in httpd.conf itself:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^123\.123\.123\.123
RewriteRule (.*) http://www.example.com/$1 [R=301,L] 

Let‘s break this down:

  • RewriteEngine on – Turns on mod_rewrite capability
  • RewriteCond – Checks if HTTP HOST matches your IP
  • RewriteRule – Redirect matching IP to your domain including path
  • [R=301,L] – Enables 301 permanent redirect with last flag so it stops processing rules
  1. Restart Apache for changes to take effect:
service httpd restart 

That covers it for Apache!

Note: You can implement these same redirects in .htaccess specifically instead of httpd.conf if preferred.

Final Thoughts

Accessing a website by IP and domain should lead to the same destination every time. Failing to properly redirect IP requests can seriously hurt your rankings and organic traffic levels.

Ensure your Nginx and Apache servers have the right 301 redirect rules configured following the steps outlined above.

Beyond just duplicate content prevention, this consolidation of equity also positively impacts rankings velocity and search visibility over time.

Let me know if you have any other questions related to IP canonicalization!