Howdy,
I’m working on a site which has a subdomain in addition to the regular site. The subdomain is pointed to a folder within the main domain folder on the server.
The problem is, the site owner wanted me to redirect requests to the main site home page (only) to the subdomain.
So http://www.domain.com needs to redirect to http://subdomain.domain.com.
Any pages that aren’t the home page should NOT redirect. So http://www.domain.com/something.html shouldn’t redirect.
I set up this rule in .htaccess in the main folder:
RedirectMatch 301 ^/?$ http://subdomain.domain.com/
The problem seems to be that this rule continues to apply to the subdomain (since its folder lives inside the main folder), which sends it into an endless redirect loop - the server realizes subdomain.domain.com matches the pattern, so it redirects again.
So I either need to rewrite my redirect somehow so it explicitly matches the home page (rather than matching any xxx.yyy.zzz without a specified page) - or - I need to add something to the .htaccess of the subdomain to cancel out this redirect once the server starts looking there.
Any ideas?
Thanks!
Bob