accessing website with apache only by domain name
Hi Team,
Need to block accessing our site using ip address . It should be only accessible with name i.e www.goodworks.com and it should not be availabe with ip address . My server ip 10.0.0.50 . I have tried like , created a .htaccess and added order allow,deny deny from 10.0.0.50 allow from all Not working . My purpose is ,if somebody hits the ip 10.0.0.50 ,nothing should come in browser . Any help is highly appreciable . thanks in advance . |
that's absolutely NOT what the allow statement is for.
There are plenty of ways to do this, mod_rewrite or some such. Personally I'd suggest using a dumym default virtualhost, especially if you already have the site correctly set up with a a virtualhost anyway. When you request a website with a virtualhost, apache will match the provided hostname to the apporpriate virtualhost definition. If none matches (e.g. if you only use an IP) then the FIRST ONE is used. So if that first one doesn't contain any content, then that's what they'll get. |
Quote:
RewriteEngine on RewriteRule ^/(.*)$ http://www.goodworks.com/$1 [R,L] |
All times are GMT -5. The time now is 08:47 AM. |