Topic: apache: setting / to map to document root? Pages that link to <a href="" title="Pages that link to Topic: apache: setting / to map to document root?" rel="nofollow" >Topic: apache: setting / to map to document root?\

Author Thread
Neurotic (0) Inmate
Newly admitted

Insane since: Apr 2006

IP logged posted posted 04-28-2006 18:33 Edit Quote

I can't figure out how to enable the option that maps a prefix / in a url to map to document root, ie:

foo.html -> /webroot/foo.html (relative to current directory: /webroot)
/images/foo.png -> /webroot/images/foo.png (even though it's included from /webroot/foo/bar/fubar/foo2 )

Is it a custom rewrite, or a httpd.conf directive?

Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

IP logged posted posted 04-29-2006 07:50 Edit Quote

Setting, maybe not, but you could start apache (if this is a single-site private server) with a custom script that also runs 'chroot /webroot/'

chroot is the *nix command that changes the apparent root directory for the current user to whever you specify. There's even better ways to do it, but I can't remember them off the top of my head.

Justice 4 Pat Richard

Maniac (V) Inmate

Insane since: May 2001

IP logged posted posted 04-30-2006 17:52 Edit Quote

what version of Apache are you running? The setting in Apache 2 is located a little different than in the older versions.

In the first version of Apache, the setting can be made in httpd.conf. There is a documentwebroot setting there that you can set to anything you want. I have a linux server at work that is set to the home directory so I can just ftp to it. It defaults to /var/www/htdocs which is only accesible to root. Can't FTP to that

In Apache2 there is a directory.conf file (I think that's what it's called) that you can set to whatever you want.

Check this out for that.

However, are you talking about virtual hosts? Where you can have a certain domain pointing to a specific directory? If so, this might help. I don't run any outside servers so I can't really help with that



Post Reply
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
Your Text:
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu