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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.