Several domains in same directory?

elDude

New member
Joined
Sep 29, 2004
Messages
3
Hello,

I want to host several domains, but those domains share same script and I don't want to copy all content. Is it possible to point all domains to the same directory?

And it should not be redirection - domains have different content that depends on $_SERVER['HTTP_HOST'] (php scripts).

If it helps: i have a reseller account with 2 ips and host uses latest directadmin.
 
You have several option within DirectAdmin:

1. Domain Pointers this will redirect AND change the url to the normal one. Probaly no use for you.

2. Site redirectors, these will just redirect /blaat to whatever you want. Probaly no use for you.

3. Create domain and make an index.html wich redirects to the correct path or a symbolic link to the other index file wich will do the redirection.

4. Create domain, remove it's public_html and symbolic-link it to the correct public_html and do you're scripting.

5. (Last) Alter httpd.conf from the destination domain and add the source to the "ServerAlias". Must be done by the administrator ;)

Well that's all I can think off :p Little bit sloppy, sorry :)
 
Thanks a lot. Method 4 seems to be what I was looking for. Any tips on how to setup link without shell access?
 
Thanks! Works perfectly. Had to temporary chmod domain's directory so nobody (or whoever is owner of php script process) could create that link.

For other users who want to redirect domain2.com to domain1.com temporary chmod directory /home/you/domains/domain2.com so everyone could write to it, rename or delete directory public_html in that directory, upload this script on domain1.com or somewhere and run it, then chmod back that directory. Here is script:
<?php
$res = symlink('/home/you/domains/domain1.com/public_html', '/home/you/domains/domain2.com/public_html');
echo $res ? 'success' : 'failed';
?>
 
Back
Top