alexwest Posted May 16, 2007 Share Posted May 16, 2007 Hi all, Need some help setting up redirect rules for a specific configuration. I have two websites under the same apache server, domain1.com in the root directory and domain2.com in root/domain2 as an add-on domain. The first website has three language versions each one in its own directory root/lang1, root/lang2, etc. and there are no files in the root directory for domain1.com. What I would like is to have a rule that redirects an access to www.domain1.com to www.domain1.com/lang1. I have tried to set this up with simple 'Redirect' rules but the problem is that a redirect of the root directory affects both domains, ie both www.domain1.com and www.domain2.com are redirected to www.domain1.com/lang1. Can anyone suggest how to set this up through .htaccess so I can get domain1.com to go to domain1.com/lang1 and keep domain2.com at domain2.com. Many thanks in advance. Cheers, Alex Link to comment https://forums.phpfreaks.com/topic/51702-solved-redirect-root-of-website/ Share on other sites More sharing options...
alexwest Posted May 24, 2007 Author Share Posted May 24, 2007 Solved this problem using another solution than mod_rewrite but thought to post it here anyway for reference. I placed an index file index.php in the root directory that redirects the traffic coming in through the main domain to the desired sub-directory. This did not affect traffic coming to the add-on domain, solving my previous problem. These are the contents of the index file: <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: ./lang1/"); exit; ?> Link to comment https://forums.phpfreaks.com/topic/51702-solved-redirect-root-of-website/#findComment-260816 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.