Forum Moderators: phranque

Message Too Old, No Replies

htaccess on sub domains

         

stevexyz

5:21 am on Oct 19, 2005 (gmt 0)

10+ Year Member



Not sure if this is possible with .htacess

Have the following sub domains:
sub1.mydomain.com
sub2.mydomain.com
sub3.mydomain.com

Is it possible by placing an htacess file in the ROOT of mydomain.com to redirect the pages called up on the sub domain requests to NEW individual sites?

EG sub1.mydomain.com/help.htm redirects to www.newdomain1.com/help.htm and sub2.mydomain.com/anotherpage.htm redirects to www.newdomain2.com/anotherpage.htm etc

Thanks

jdMorgan

1:39 pm on Oct 25, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



stevexyz,

The answer depends on how those subdomains were configured. If you have put an .htaccess file in the top Web-accessible directory of your main domain that looks at the requested hostname and 'steers' the request to the subdirectory corresponding to that subdomain, then the answer would be "yes."

If the subdomain-to-subdirectory mapping is done in httpd.conf (for example, using a 'control panel'), then you won't be able to have a single .htaccess file that affects all subdomains for the simple reason that .htaccess files are only executed if they reside in the directory path between the server root and the file that is ultimately served.

Jim

stevexyz

10:36 pm on Oct 27, 2005 (gmt 0)

10+ Year Member



Thanks Jim

Only just got to see your reply now - with the forum being down all this time.

paulfp

5:28 pm on Nov 11, 2005 (gmt 0)

10+ Year Member



Hi guys,

So is there a way to get my .htaccess file to work with subdomain.mydomain.com?

My subdomains are set up using a control panel so I think it's with httpd.config.

the actual path of my subdomain's pages are in the form www.mydomain.com/_subdomain.... so can I put another .htaccess file in there, which points to "../.htaccess" or something?

thanks :)

jdMorgan

7:31 pm on Nov 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, you can't do it in the HTTP/server context.

However, you could define a *nix symlink to the common .htaccess if you have shell access to your files.

Jim