How to point all domains to single .php script?

Hello,

I have few domains like site1.com, site2.com, site3.com and I’d like to use one script for them.

I’ve tried this:
RewriteRule ^index.html$ /home/mainsite.com/www/index.php

But it doesn’t work. I wonder is it possible to use one script for multiple domains?

al,

What is the DocumentRoot for the domains? This is a DNS problem, too, not a mod_rewrite problem.

Once you get to the point that sites 2 & 3 are “parked” on site 1, then use DirectoryIndex for that!

Finally, when you need to use mod_rewrite, PLEASE use proper code, i.e., the redirection should specify a path within your “webspace,” NOT a physical path on your system.

Regards,

DK

Each domain has it’s own “www” folder:
/home/mainsite.com/www/
/home/site2.com/www/
/home/site3.com/www/

I wonder is there any way to use single PHP script for all domains? If I can’t use mod_rewrite for that, what should I use?

Ok, I’ve used Linux’ ln to create links from paths like:
/home/site2.com/www/
/home/site3.com/www/

to:
/home/mainsite.com/www/

It works now, I can detect which domain user loads at the moment with $_SERVER[‘HTTP_HOST’].

I wonder should I use this way or I can get some problems with this method?

Yes, use an include() statement within your scripts. You cannot use one file for domains which are located in mutually exclusive paths, i.e., not in a single “webspace.”

You’ve just merged site2 and site3 on top of mainsite. cPanel calls that “parked” domains. I don’t believe that’s what you’re trying to do, though, is it? If so, just go back and redefine the DocumentRoot for all three domains to be co-located and the problem is solved.

Regards,

DK