Jump to content

subdomain redirect to different homepage


dr.pepper

Recommended Posts

Ive got a website with a subdomain and I want to change the homepage for the subdomain. I.e www.website.com goes to www.website.com/index.php, however when I go to the subdomain I want the homepage to show a different page. Ie I want test.website.com to go show test.website.com/test/index.php

 

Is this possible?

Showing a different page is possible, do you really want to show a page that's actually in a different folder though, that sounds strange to me?

 

If the file is in the same folder you can use the DirectoryIndex directive, not sure it will work for a file outside the folder though. You could probably achieve the result with mod_rewrite using something like...

 

RewriteCond %{HTTP_HOST} ^test\.website\.com$
RewriteRule ^$ http://test.website.com/test/index.php

 

I guess it depends on your overall objective.

Showing a different page is possible, do you really want to show a page that's actually in a different folder though, that sounds strange to me?

 

If the file is in the same folder you can use the DirectoryIndex directive, not sure it will work for a file outside the folder though. You could probably achieve the result with mod_rewrite using something like...

 

RewriteCond %{HTTP_HOST} ^test\.website\.com$
RewriteRule ^$ http://test.website.com/test/index.php

 

I guess it depends on your overall objective.

 

I want the subdomain to show a different homepage to the main website. The main websites homepage is /index.php and I want the subdomain to land on /test/index.php. It doesnt matter if it simply re-directs to test.website.com/test/index.php but it would be better if it could land on test.website.com but show /test/index.php.

 

Hope that makes sense.

 

Cheers

No it doesn't really make sense, because a sub-domain should point at a different folder to your root anyway, so it's index page should be the index.php file that is in that folder, unless you are trying to 'fake' sub-domains with mod_rewrite. How have you set the sub-domain up?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.