0

I have a self-hosted and self-managed web server using Apache 2.4 on Debian. I use many domains on this server and have configured them using vhosts.

I want my users to use the domains I configured to connect with, instead accessing the server by its IP address. In other words, users currently can connect to my server using: http://XX.XXX.XX.XXX/my/web/page and I want to block that from occurring. Instead I want them to use: https://example.com/my/web/page.

How can I deny access to this webserver's pages when users try using its IP address for the URL?

2
  • 1
    Set up a vhost for XX.XXX.XX.XXX which pops up an error, or do that on the default vhost and ensure your customers use an alternative vhost.
    – davidgo
    Dec 6, 2022 at 8:26
  • 1
    And besides @davidgo correct comment, switch to HTTPS only and problem solved too (because certificate won't match the IP address so browsers won't allow going there). Dec 6, 2022 at 15:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.