Skip to main content

SEO

knackforge blog knowledge base
Tag(s)

Apache redirect IP requests to domain name

At times Apache is configured to serve a site through IP address as well. For a production site with proper domain and things this could affect SEO due to content duplication.

Quick fix for the same could be to have a redirect rule in .htaccess file which comes by default in most of the web applications.

The below rewrite will do the trick,

RewriteCond %{HTTP_HOST} ^74\.127\.228\.193$
RewriteRule ^(.*)$ http://google.com/$1 [L,R=301]

The first line checks if the request is posted through IP address while the second line redirects to domain name on match.

Subscribe to SEO