I have a managed server (unable to control apache settings) with the default document root of: /var/www

I have a web app running in: /var/www/subdomains/app/webroot

I have a dedicated domain managed by the host that has the aforementioned webroot which works perfectly. I would like to allow externally provisioned domains to point to the server/web app via A Record config. If I access the site via IP, it takes me to the index located in /var/www.

I would like to configure the .htaccess in my /var/www directory to rewrite requests from the external subdomain to the /var/www/subdomains/app/webroot directory. I've done so using the following rules:

  RewriteCond %{HTTP_HOST} external\.domain\.com$ [NC]
  RewriteRule ^(.*)$ /var/www/subdomains/app/webroot/index.php?url=$1 [L,QSA]

When accessing external.domain.com, the app loads properly, but the paths to things like CSS files, images, etc. are prefixed with "/subdomains/app/", causing broken links.

I've tried changing the RewriteBase (both in /var/www and /var/www/subdomains/app/webroot), as I believe that's what it's designed for - but no luck.

Any ideas?

FYI the app is built on CakePHP.

Thanks

link|improve this question

25% accept rate
feedback

1 Answer

RewriteBase isn't applicable. Nothing in mod_rewrite is going to alter the HTML and javascript in your web pages.

You need to somehow tell the application that it is installed in / and then mod_rewrite will handle translating that into filesystem paths.

I don't use CakePHP but it looks like setting App.baseUrl to / would work.

link|improve this answer
Tried changing the App.baseUrl but no luck... – 1nsane Aug 10 '10 at 22:50
feedback

Your Answer

 
or
required, but never shown

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