: Website opening both on domain name and IP. Is that a problem? So, http://site.com/ and http://123.321.123.32/ both are displaying a web page. From SEO point there is content duplication issue
So, site.com/ and 123.321.123.32/ both are displaying a web page.
From SEO point there is content duplication issue when both domain and IP displays the same content. This can be solved by canonical tag.
But what other problems does this make?
More posts by @Alves908
2 Comments
Sorted by latest first Latest Oldest Best
You may run into issues with duplicate content. You probably do not want to create canonical tags when they are not necessary. Too much work.
You can try a redirect:
RewriteCond %{REMOTE_ADDR} ^123.321.123.32$ [NC]
RewriteRule ^(.*)$ site.com/ [R=301,L]
Of course you can adjust this to suit your needs. Insert this into your .htaccess file.
When I build a new web server, I like to make the first site created a blank site. This blank site will capture all IP based requests. You can do what you want with these requests. In a virtual host scenario with multiple sites, you can chose to ignore these requests (like I do) or redirect the request to a particular site (like I am considering). Most people chose to treat IP based requests differently due to security. This was my original intent. But now I am not so sure this is a huge issue. I am sure someone will school me on this! I have to re-evaluate the situation to determine if there are true security risks in IP based requests. My original thought was that these were primarily hackers, scrapers, and so on. That may still be the case. It may also be lost opportunity. I will leave that up to you to decide. Check your log files and make that determination.
If you want to simply block these requests, you can use this code.
RewriteCond %{REMOTE_ADDR} 123.321.123.32 [NC]
RewriteRule .* - [F,L]
I think I would use the redirect if given the choice.
It doesn't make any problems. You can prevent it by adding another virtual host for the same IP in your apache or nginx web server. This will attract ip-based access without a hostname and your main site will only be accessible by host name.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.