Forum Moderators: phranque

Message Too Old, No Replies

htaccess wildcard dns

         

mackgreen

3:37 pm on Aug 2, 2004 (gmt 0)

10+ Year Member



I will start by saying that I am very new to htaccess files.

I have a site admin directory that I am password protecting with an htaccess file and my host has wildcard dns enabled in apache. I am using a php script to customize the content that is used to provide dynamic content based on the subdomain. Like this:

sub1.site.com/admin/index.php is admin for sub1
sub2.site.com/admin/index.php is admin for sub2
and so on.

What I am finding is that each subdirectory has to validate for the htaccess file. I would rather be able to have a single login for the admin directory that would allow me to admin each of the subdomains without having to relogin. Any suggestions? Do I need to rewrite? If I do, will the original domain be accessable to my php script?

jdMorgan

1:35 am on Aug 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mackgreen,

Welcome to WebmasterWorld [webmasterworld.com]!

The key to this is to find out where your subdomains are "mapped" to server file subdirectories. The "fix" must be applied there, in order to put your admin section into the same authorization realm regardless of subdomain.

Jim

mackgreen

2:41 pm on Aug 3, 2004 (gmt 0)

10+ Year Member



In clarification, there is no physically different directories for these subdomains. All of the handling is accomplished in the index.php script.

This is why it is a little baffling to me. When I am accessing sub1.site.com/admin/index.html it is the exact same file that I am accessing with sub2.site.com/admin/index.html.

In the authorization popup box the only difference is in the site name.

jdMorgan

3:20 pm on Aug 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, but authorization is URL-based, not filename-based. The authorization realm is taken from the URL. Therefore, you need to redirect to a common realm (domain or subdomain) before the authorization phase is invoked. So, it depends on where (i.e. httpd.conf or .htaccess) the subdomains are handled and where the authorization is handled. You'll need to redirect to a common realm at a level 'above' that where authorization is invoked.

Jim