share files for different subdomains

Using a single web hosting account to host multiple sites

share files for different subdomains

Postby trash-box » Sun Aug 31, 2008 6:49 am

filestructure:
Code: Select all
/home/example.com/www    DOCUMENT_ROOT for www.example.com
/home/example.com/admin  DOCUMENT_ROOT for admin.example.com


I want to share some javascript, CSS and image files inside the www-folder. i've done this with a .htaccess in /home/example.com/admin

Code: Select all
RedirectMatch ^/(pix|js|css)/(.*) http://www.example.com/$1/$2 [L]


this works perfect for CSS and images. And also for most javascripts. But some javascript-code has to be loaded from the same host as the html-file to work correct (e.g. for AJAX functionality).

how can i change this to load the javascript files from /home/example.com/www/js but deliver them through http://admin.example.com/js?

my idea is not to upload javascripts twice. an other possibility is to create a symbolic link from /home/example.com/admin/js to /home/example.com/www/js. but im not able to create symbolic links...

i hope it is clear what i mean.
thx
trash-box
 
Posts: 1
Joined: Sun Aug 31, 2008 6:33 am

Postby richardk » Sun Aug 31, 2008 8:46 am

Do you have access to the <VirtualHost> to use an Alias?

You can't rewrite outside the document root so you would have to use mod_proxy with mod_rewrite
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^js(/.*)?$ http://www.example.com/$0 [P,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 21 guests

cron