Jump to content

Recommended Posts

Hi, firstly apologies if this problem has already been answered or is really simple, I've looked around a lot and can't find a solution.

 

In a nutshell I have domain1.com as my main domain and domain2.com, domain3.com etc - and one hosting account. I'm trying to get them to appear as seperate websites but reside on the same hosting account. I've been using CPanel to try and set this up so far.

 

I can set it up so domain2.com will re-direct to domain1.com/domain2 - or domain2.domain1.com, or even 'mask' domain2.com so it uses the same root directory as domain1.com and all the links appear to be a different web site (e.g www.domain1.com/page2.html and www.domain2.com/page2.html are the same page but appear differently in the address bar).

 

What I want is domain2.com to be a different website to domain1.com, but store the files for domain2.com in a folder (domain1.com/domain2) - so if the user types in www.domain2.com/page2.html they won't get re-directed but the file will be stored here: domain1.com/domain2/page2.html

 

Does this make sense? and is it possible? Looking around I've seen a people referring to cloaking and masking scripts, is this the only - or best way to do this?

 

Here is what is currently in my .htaccess:

 


RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain2.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain2.com$
RewriteRule ^(.*)$ "http\:\/\/www\.domain1\.com\/domain2\/" [R=301,L]

 

The other option I have is to set up seperate hosting accounts for each of my domains, which for various reasons isn't what I'd like to have to do.

 

Thanks!

Ok after a long while looking around I've found some code which works if you put it in the .htaccess file of the public_html of the main domain (which would be domain1.com in the above example).

 

Could anyone tell me how this is actually working? I've fiddled around with it, deleted bits to see what happens but really have no idea why this works...

 

 


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/domain2/
RewriteCond %{HTTP_HOST} ^domain2.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain2.com$
RewriteRule ^(.*)$ domain2/$1 [L]

 

 

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.