How to Redirect IP to Domain Name using .htaccess

It is important for the SEO to resolve your website and IP address to the same URL and duplicate content is not at all good for the SEO, and that is something you should fix it immediately.

In this Knowledgebase, I will guide how to fix it using .htaccess file:

You need to create an .htaccess file in the website's directory if not there, and add the following lines of code (replacing the IP and domain name with your own):

RewriteEngine On
RewriteBase /RewriteBase /
RewriteCond %{HTTP_HOST} ^12\.34\.56\.789$
RewriteRule ^(.*)$ http://www.yourdomainname.com/$1 [L,R=301]

After save the file and access your IP address manually to check if it is getting redirected to your domain name.

  • How to Redirect IP to Domain Name, IP to Domain Name, IP to Domain Redirect, Redirect IP request to Domain URL, Redirect IP to domain name, Redirect IP to domain name htaccess
  • 477 Users Found This Useful
Was this answer helpful?

Related Articles

How to install Attracta SEO Plugin On cPanel/WHM Server Freely

Hey Guys,Before we begin to install this plugin, let's first understand what is this plugin all...

Server Error 503 Service Temporarily Unavailable

Cause PHP-FMP Service is stopped or not running from the PHP version you have set. Resolution...

How to Redirect From HTTP to HTTPS CentOS Web Panel CWP Hosting

You can redirect from HTTP to HTTPS by adding the following code in your .htaccess file, If it is...

How to Redirect From HTTP to HTTPS CentOS Web Panel CWP Hosting

You can redirect from HTTP to HTTPS by adding the following code in your .htaccess file, If it is...

How to Redirect From HTTP to HTTPS CentOS Web Panel CWP Hosting

You can redirect from HTTP to HTTPS by adding the following code in your .htaccess file, If it is...