[support] rescrit access to a subdomain
Jamie Holly
hovercrafter at earthlink.net
Sun Feb 28 14:26:31 UTC 2010
Why not just set a cookie on example.com (make sure the cookie domain is
.example.com so it can be read on subdomains). Don't set the expire date
so it deletes when the browser is closed. Now on subdomain.example.com,
check for that cookie. If it doesn't exist they are redirected to
example.com.
You could also try using HTTP_REFERRER on the subdomain site, and if it
doesn't equal *example.com then it redirects to the top site. I would
advise against that though since a lot of internet security suites alter
and/or strip out the referral header and they will never be able to
access it.
A final option, if you aren't using any advanced page caching on the top
site (such as Boost). Check for the session cookie in the subdomain
site. To do this you would have to set the $cookie_domain in
settings.php on the top site to .example.com, and then copy that
variable over to your subdomain.example.com. Now just look for
$_COOKIE[md5($cookie_domain)]. If example.com is on SSL then you will
need to append SSL to the end of $cookie_domain on the subdomain site
only (it does it automatically in Drupal).
Jamie Holly
http://www.intoxination.net
http://www.hollyit.net
On 2/28/2010 5:49 AM, Simone Dal Maso wrote:
> Hi,
> I don't know if this is a drupal issue, so I apologize if this request is
> made in the wrong place.I have my website, www.example.com.
> I create a subdomain and it is properly running, with help of domain module.
> http://subdomain.example.com
>
> this subdomain is a service for a customer that has his own website, not
> with drupal, but wants a particular service and I make it for him. He wants
> that:
> http://subdomain.example.com
> is accessible only from its link in his homepage, not from external user. In
> a few words, the subdomain should work only if the visit comes from his
> website.
> Do you think that a similar thing have sense?
> I still didn't give any answer about it, because it appears to me a strange
> request and I don't know how to realize it.
>
> What do you think about it?
>
> ps: I really thank this group because every time I made a question I always
> had a good feedback, sometime I forgot to thank people.
>
>
More information about the support
mailing list