.htaccess - How do I allow access only when requested with correct hostname in apache? -
i have web server running on 230.230.230.230
. have virtual host set servername mywebsite.com
, documentroot /var/www/html/mywebsite.com/public
given file /var/www/html/mywebsite.com/public/index.html
, how allow access http://mywebsite.com/index.html
not http://230.230.230.230/mywebsite.com/public/index.html
?
preferably place .htaccess
file in /var/ww/mywebsite.com
redirect ip-based/other hostname traffic correct hostname.
edit: ended doing .htaccess
rewriteengine on rewritebase / rewritecond %{http_host} !^mywebsite\.com$ [nc] rewriterule ^(.*)$ https://mywebsite.com/ [r=301,l]
Comments
Post a Comment