2

This is an outside shot I know. I am supporting a site that has constantly changing assets that are excluded from the repository for obvious reasons. Currently I am having to FTP these assets to my local computer in order to develop and test properly. What I want to do is simply link to the assets on the server. I thought this might be possible using Apache's mod_alias, but I cant get it to work:

Alias /assets http://www.mysite.com/assets

Is this possible? Is there an alternative way of doing this?

Thanks

1 Answer 1

5

You can use mod_proxy to make Apache fetch resources from a remote server and then return them under that URL:

ProxyRequests Off
ProxyPass /assets http://www.mysite.com/assets
ProxyPassReverse /assets http://www.mysite.com/assets

http://httpd.apache.org/docs/2.0/mod/mod_proxy.html

3
  • 2
    yes (+1), mod_alias is a way to map an url to a local filesystem resource. Mapping an external web resource is the job of a proxy.
    – regilero
    Commented Mar 29, 2012 at 19:03
  • 2
    what if you wanted to create the redirection from a virtual host? I mean to make http://mysite.localhost point to http://www.mysite.com... how would you proceed?
    – Jago
    Commented Jul 23, 2013 at 4:16
  • 1
    @Jago same way, just use the directives above inside your vhost definition and add ServerName mysite.com and ServerAlias www.mysite.com. You just need to ensure DNS for mysite.com resolves to your vhost mysite.localhost definition. Commented Jan 31, 2014 at 17:33

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.