When I visit my website by its IP address the welcome page of Apache showed, but with "https://domain-name.net" everything is OK. How can I block direct access by IP or forward it to domain?
I enabled "mod_rewrite" and my Virtual Host config is:
Code: Select all
RewriteEngine on
RewriteCond %{SERVER_NAME} =mydomain.com [OR]
RewriteCond %{SERVER_NAME} =www.mydomain.com
RewriteCond %{HTTP_HOST} ^"Server IP Address"
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Thank you.