Forum Moderators: phranque

Message Too Old, No Replies

.htaccess domain redirect to specific folder

         

prmirage

10:25 pm on Jan 23, 2007 (gmt 0)

10+ Year Member



Hi folks...New to the site..:)

Okay, so modifying .htaccess files is a new world to me. I probably shouldn't play around with it given my lack of experience but I like to learn new things and I HAVE TO learn this one. I have found a few posts that appear to explain it but I am having trouble deciphering where I should put my info. So here is my problem:

Working on a site for a friend who has xyz.com as main site. He has purchased a new domain wxyz.com and I need to share the space between both. When I type wxyz.com in my browser I get xyz.com - Not what we want. I have created a folder off the root named wxyz and would like to put all content files for wxyz.com there and be able to type wxyz.com in my browser and be directed to the appropriate content and actually have the browser reflect wxyz.com and not xyz.com.

I know the host company allows this as they told me themselves. They also have a tool that can do it automatically for a nice little fee of 27.00 per month - Not an option.

I could sure use someones help on this with the code and where exactly to put my information within it. Thanks to all...

prmirage

coopster

11:24 pm on Jan 23, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, prmirage.

You seem to be describing Virtual Hosts [httpd.apache.org] as opposed to redirection. The Apache manual is a great resource. It might not hurt to brush up on what exactly .htaccess files are and how to use them, too. The Apache Tutorial: .htaccess files [httpd.apache.org] is a good start.

prmirage

12:36 am on Jan 24, 2007 (gmt 0)

10+ Year Member



Coopster...

Thanks for the info but it didn't really help much. I will take the time to read more into it at a later date as I see how it could be helpful in the future. For now I'm basically looking for the code I can just past in and replace with my info.

I found this and changed the info for mine and something interesting is happening:

RewriteCond %{HTTP_HOST} ^(w{1,3}\.)?2ndDomain\.com$
RewriteCond $1!^2ndDomain-subDirectory/
RewriteRule (.*) /2ndDomain-subDirectory/$1 [L]

now the 2nDomain.com shows as [2ndomain.com...] with all of the 1stDomain content. I can navigate through the site fine but it basically didn't go to my 2ndDomain-subDirectory/index.htm page. which basically has test in the body.

I feel that I am close and perhaps I didn't change something correctly. Any thoughts?

Thanks in advance...

jdMorgan

2:51 pm on Jan 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you declare a DirectoryIndex [httpd.apache.org] in 2ndDomain/subdirectory? If you've already done so, is that page generated dynamically? If it is, look to the script to find out why it's failing when accessed via 2ndDomain.

Jim