PDA

View Full Version : How to prevent user access subdomain?



amgong
03-14-2007, 07:36 PM
Now I have www.main.com' and www.addon.com(it's pointing to addon.main.com)

And how to prevent user to access the addon.main.com or main.com/addon?
e.g show a 404 page or something...

Thanks.

areidmtm
03-14-2007, 07:56 PM
Create a file called .htaccess with any text editor (if you don't already have one) in the add-on domains folder and place this code in it.



RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.addon-domain.com$
RewriteRule ^(.*)$ http://www.addon-domain.com [R=301,L]


This will redirect them back to the proper way of accessing the add-on domain