We help IT Professionals succeed at work.

Absolute paths in subdirectories

adammorland asked
Last Modified: 2012-05-08
I am developing a site and am using absolute paths for various 'include_once' statements. This is fine for the final live deployment of the server.

The problem I have is that on my development server the site is not situated in the root directory, they are in root/proofs/ww/

Is there a way perhaps using htaccess or php to change this root directory in this environment to include this - without having to change ALL links manually before deploying it?
Watch Question

if dir ww in root/proofs/ww is defined as document root then absolute path will work w/o any need of htaccess; check vh if not sure if it's already defined


how do I define the document root though?
This one is on us!
(Get your first solution completely free - no credit card required)

^ That is assuming you want to define a directory in php. If you want to use Apache to define a virtual host, you need to add the following to your httpd.conf file, or turn on your virtual host file and add it there:

<VirtualHost *:80>
    ServerAdmin      email@domin.com
    DocumentRoot      "/root/proofs/ww"
    ServerName      sub.domain.com
    ErrorLog            "logs/sub.domain.com-error.log"
    CustomLog            "logs/sub.domain.com-access.log" common

That will create a virtual host and when someone goes to the url "sub.domain.com", assuming that "domain.com" is attacked to the IP of the apache server, it will direct them to "/root/proofs/ww" as if it were the document root.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.