To redirect a file request from application server to apache server
Currently my site's static content is residing in the application server. The plan is to move it to the apache server. But the problem I am facing is, as the html files are dynamic includes, the contentroot is getting attached to the request. And therefore, even though i am giving an 'Alias' in the virtual host of the apache conf, it does not get redirected properly.
For example: My Jsp is footer.jsp inside which i am calling /static/footer.html as jsp include. The static folder is now under apache. So my url is: - //localhost:8840/ar/common/footer.jsp and i am trying to access: - //localhost:8840/static/footer.html. But the request is always processed as: - //localhost:8840/ar/static/footer.html.
In the 'virtual_hosts.conf' i have ad开发者_运维百科ded: (running different hosts under the same IP) - Alias /static /opt/Apache2.0.54/htdocs/ar/static
I am completely new to Apache and would greatly appreciate any guidance. Hope the problem is clear. I could provide more details if any questions. I do not know what more details are needed. Thanks.
I think you could use a symbolic link to link /static/ to /ar/static/.
ln -s /static /opt/Apache2.0.54/htdocs/ar/static
This will create a directory link named static in ar to the real static directory, so when you will try to access localhost:8840/ar/static/footer.html
you will access localhost:8840/static/footer.html
精彩评论