How to Solve IP Canonicalization Problem

IP Canonicalization Image

The IP canonicalization problem occurs, when a website’s IP address and website’s URL display the same page, but do not resolve to the same URL.

Let’s consider your domain name is and its IP address is When IP address is visited in web browser as, the web server displays the same page as

From a SEO point of view this would cause a duplicate contents problem.

You can see the following image for more understanding:

Good IP Canonicalization

The solution is to create a 301 redirect, a permanent redirect from your one URL to another. You need to redirect website’s IP to the website domain. To do the redirect, you can edit the .htaccess file found in the root directory by adding the following code:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^25\.50\.50\.25 [nc,or]
RewriteCond %{HTTP_HOST} ^example\.com [nc]
RewriteRule (.*)$1 [R=301,L]

For above code, you need to replace the 25\.50\.50\.25 with your website’s IP address and replace with your domain name.