Condensing multiple domains using .htaccess

Hi all,
I’m currently hosting multiple domains on a single web space. The files for each website are located in different folders:

domain1.com in /public_html/folder1
domain2.com in /public_html/folder2
domain3.com in /public_html/folder3

All of the sites are the same, with the exception of some personal data, some photos, and some links. So, I wrote some php code to swap out these details, based on an ID from the query string. Everything is ready, but now I’m looking for a way to use my .htaccess to redirect requests for each of the domain names to the same folder and file, but with a different query string parameter.

E.g.
domain1.com -> /public_html/folder4/index.php?id=1
domain2.com -> /public_html/folder4/index.php?id=2
domain2.com -> /public_html/folder4/index.php?id=2

Also, obviously, the domain names needs to be preserved:

domain1.com -> domain1.com/index.php?id=1
domain2.com -> domain2.com/index.php?id=2
domain3.com -> domain3.com/index.php?id=3

I’m a novice with .htaccess, and so am having one heck of a time getting this working.

Can some kind soul out there help me out with this one?

Thanks!

Sponsor our Newsletter | Privacy Policy | Terms of Service