Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Someone just set up a directory for me on an Apache server where I will put my PHP application. This directory has an external path of 192.168.1.5/app and points to /home/test/app.

My application references its files by means of URLs like /img/logo.png, rather than ../img/logo.png or something similar. The problem I'm experiencing with this is that these URLs now point to 192.168.1.5/img/logo.png instead of 192.168.1.5/app/img/logo.png.

In IIS, to fix something like this, I would declare the app directory as an application, which would set the root URL to that directory. How do I do something similar in Apache (using this method or something else entirely)?

share|improve this question

2 Answers 2

Mod rewrite. There are so many different configurations that I can't post any specific ones here. But you could use dreamweaver to update all links. Are you trying to get /test/app/images/stuff? What directory are the images in? And it is a good thing you are in relative path mode. That saves much time. Try putting the images folder inside test folder.

share|improve this answer

It sounds like you just need to change the DocumentRoot for this application. Since you're accessing it via IP (instead of hostname), I'm guessing that you're using the default apache vhost. If so, change the DocumentRoot in your httpd.conf file to point to /home/test/app, restart apache, and you should be all set.

share|improve this answer
    
This sounds like what I'm looking for, but I'm not sure whether I can get access to httpd.conf. Is there a way to do this through .htaccess? –  Maxim Zaslavsky Sep 7 '11 at 20:31
    
No, you cannot change the DocumentRoot via .htaccess. –  EEAA Sep 7 '11 at 20:34
    
Okay, thanks! Sorry, I just have one last question: since this isn't the only application on the server, should I look up DocumentRoot or VirtualDocumentRoot? In other words, which is more appropriate here? –  Maxim Zaslavsky Sep 7 '11 at 20:43
    
If you have more than one application, then you need to change the DocumentRoot in whatever VirtualHost that is serving this application. –  EEAA Sep 7 '11 at 20:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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