0

I have a number of domain names all pointing to the same server and I'm looking for a way to access a set of scripts in a single location from each domain name as a kind of shared resource.

e.g.

http://abcdeals.com/shared-resource/
http://defdeals.com/shared-resource/
http://hijdeals.com/shared-resource/

all use the same files at /home/zdeals/public_html/shared-resource/


Full details:

The "shared resource" files reside in the following server path

/home/zdeals/public_html/shared-resource/

The multiple domain names e.g. (abcdeals.com, defdeals.com and hijdeals.com) reside in the following server path

/home/abcdeals/public_html/
/home/defdeals/public_html/
/home/hijdeals/public_html/

Ideally I would like to be able to access the shared resource files without redirecting the user by accessing

http://abcdeals.com/shared-resource/
http://defdeals.com/shared-resource/
http://hijdeals.com/shared-resource/

I've been looking at alias and mod_rewrite but to no avail. Some things I've tried in /home/abcdeals/public_html/.htaccess

AliasMatch ^/shared-resource(.*) /home/zdeals/public_html/shared-resource$1

or

RewriteRule ^shared-resource/(.*) home/zdeals/public_html/shared-resource/$1 [L]

...and many more similar

I either get a 500 internal server error or 404 not found error when accessing http://abcdeals.com/shared-resource/

I also have access to the httpd.conf file if that helps.

The existing .htaccess file is as follows

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
#RewriteBase /
RewriteRule . index.php [PT]
RewriteRule ^(system/(classes|locale|schema|$)) index.php [PT]

I will be eternally grateful for any help on this.

3
  • 1
    I have never done this so I'm not sure if this is the right direction... But have you tried using Symbolic links (soft links)?
    – YonoRan
    Commented Mar 23, 2012 at 21:16
  • Interesting idea, I'll have a look into it
    – Andy Gee
    Commented Mar 23, 2012 at 21:19
  • You should add that as an answer, it worked perfectly. Thanks :)
    – Andy Gee
    Commented Mar 23, 2012 at 21:48

1 Answer 1

0

You can use symlinks for this. In linux you can do this by:

ln -s /home/zdeals/public_html/shared-resource/ /home/abcdeals/public_html/shared-resource/

Which creates a symlink /home/abcdeals/public_html/shared-resource/-->/home/zdeals/public_html/shared-resource/

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.