dr.pepper Posted April 26, 2010 Share Posted April 26, 2010 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 https://forums.phpfreaks.com/topic/199846-subdomain-redirect-to-different-homepage/ Share on other sites More sharing options...
cags Posted April 26, 2010 Share Posted April 26, 2010 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 https://forums.phpfreaks.com/topic/199846-subdomain-redirect-to-different-homepage/#findComment-1048991 Share on other sites More sharing options...
dr.pepper Posted April 26, 2010 Author Share Posted April 26, 2010 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 https://forums.phpfreaks.com/topic/199846-subdomain-redirect-to-different-homepage/#findComment-1048995 Share on other sites More sharing options...
cags Posted April 26, 2010 Share Posted April 26, 2010 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 https://forums.phpfreaks.com/topic/199846-subdomain-redirect-to-different-homepage/#findComment-1048998 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.