[SOLVED]Subdomain redirection problem

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
idevlin
Forum Commoner
Posts: 78
Joined: Tue Jun 26, 2007 1:10 pm
Location: Cambridge, UK

[SOLVED]Subdomain redirection problem

Post by idevlin »

I'm currently having an issue with redirecting a subdomain I've created and was wondering of anyone here could help.

Here's the scenario:

Domain is http://www.domain.com which contains index.php
Subdomain is test.domain.com

Creating this via the CPanel is all good and it created a directory: http://www.domain.com/test which contains an empty cgi-bin directory and a holder index.html file.
Browsing to test.domain.com works fine, the contents of index.html are displayed

I then create an index.php and place it in http://www.domain.com/test and remove the index.html file
Now, browsing to test.domain.com redirects to http://www.domain.com and loads the index.php file there.

I can't for the life of me understand why it is doing this, as it makes no sense to me. I've tried various settings in the .htaccess file from Google searches, but to no avail.

Can anyone help with this? Thanks in advance.
Last edited by idevlin on Sun Aug 17, 2008 2:44 am, edited 1 time in total.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Re: Subdomain redirection problem

Post by neophyte »

Subdomains on shared servers (cpanel) usually have a directory with a "public_html" directory of some sort. Is the directory where test.yourdomain.com in your public_html directory? It may be that you master domain is the default for your subdomains.
User avatar
swiftouch
Forum Commoner
Posts: 80
Joined: Sun Dec 10, 2006 7:35 am
Location: Salt Lake City, Utah

Re: Subdomain redirection problem

Post by swiftouch »

I have no idea if this will even make any difference but you can always try putting this in the htaccess file under /test

Code: Select all

DirectoryIndex index.php index.html
User avatar
idevlin
Forum Commoner
Posts: 78
Joined: Tue Jun 26, 2007 1:10 pm
Location: Cambridge, UK

Re: Subdomain redirection problem

Post by idevlin »

It turned out to be Wordpress being daft and redirecting back to the main index.php rather than staying where it should have been in the subdomain.

Thanks for the replies though.
Post Reply