Hi!
is there a way to deny direct ip access to any website on the server. This server run apache 2.4. I have one server with nginx and there it is simple but I have tried to find a solution for apache.
Replace the numbers with your actual website domain IP.
If HTTPS is enabled, visitors (may) see an unsecured certificate window, but it’s still possible to click through the options to access the website through the direct IP. If so, the 403 response will be displayed.
Alternative:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.example.com
RewriteRule (.*) https://www.example.com$1 [R=301,L]
Any request that doesn’t contain your website domain, will be force-redirected to your domain.