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 Quote Link to comment 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; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.