.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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -