Question

How to prevent somebody's domain from pointing to my droplet?

Hi, developers

I have recently moved my site from shared hosting to the Digital ocean. And believe or not it was a tough step for me as I don’t have deep knowledge about the server configuration.

After two months, everything is going well so far, but recently, I have started to face a security issue.

Someone has pointed their domain to my IP. I.e domain.com is also accessible from freedomain.com. I have got to know about the cause and it pretty much hurting my page ranking. My issue is something like this

Can anybody suggest how to deal with this?

PS: I can’t try this How to Rewrite URLs with mod_rewrite for Apache on Ubuntu 18.04

My server configuration: Ubuntu 18.04 Apache Wordpress

Thanks. Rohit


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

What I could suggest here is:

  • Create a Virtual Host for your website, here is a step by step guide on how to do that:

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04

  • After that set your Default Virtual Host to deny all traffic. For example, you could use something like this:
<VirtualHost *:80>
    <Location />
    Order deny,allow
    Deny from all
    </Location>

    ...
</VirtualHost>

That way if a domain name does not have a Virtual Host on your server, it would be routed to the default Virtual Host which would result in a 403 Forbidden error.

Hope that this helps! Let me know if you have any questions. Regards, Bobby