Forum Moderators: phranque
However, the way that the server is set up, when I use the forward slash in hyperlinks or image paths, it takes me to the root directory of the server, not the root of my webpage.
I'm new to Apache, but I was under the impression that / should take me to the path set up as my DocumentRoot. Is there any way to make this go to a new place using an .htaccess file, or should I contact my new web administrator?
Thanks for any help you may offer -- please ask if you need any more clarification of my problem.
Maybe I don't understand what you are stating?
Welcome to WebmasterWorld!
> However, the way that the server is set up, when I use the forward slash in hyperlinks or image paths, it takes me to the root directory of the server, not the root of my webpage.
That's a serious server misconfiguration problem, and a security threat as well. The host needs to fix it.
Jim
If you are saying yourdomain.com/thisdirectory/index.html takes you back to yourdomain.com/ then yes you have a problem and need to contact your host.
Luckily, this does NOT happen. Any URLs go to the proper place in the server, just like they're supposed to.
My problem is that if I create a hyperlink like so: <a href="/pagetwo.html">page two</a> then the server looks in the root of the entire server for pagetwo.html, not the root of my web directory.
My folder's two levels down from the server's htdocs folder, so that I'd have to say "/departments/usp/[some file]" to get to my root directory. I also have to say $_SERVER['DOCUMENT_ROOT'].'/departments/usp/[some file]' to access my folder through the PHP DOCUMENT_ROOT superglobal.
My question is whether there is any way to use an .htaccess file to reset the location of my root directory. I've tried using the DocumentRoot directive, but I don't think it's made to be overridden by an .htaccess file. Also, if my DocumentRoot was in the wrong place, wouldn't URLs not go to the right place (as The Contractor said)?
I've never been on a server configured like this before, and I thought that I might have to contact the host. If someone would kindly reaffirm that this is a configuration problem (and not one that can I can fix), then I'll start bugging the admin immediately.
Thanks again! I really appreciate your help.
P.S. -- As an afterthought, do any of you know how one might set up a server like they did (points to the right directory for the index file, but has the root directory somewhere else)? I decided to try and set my server up to emulate the one that I'm having problems with so that I could try and find a possible work-around, but I can't think of any way to set it up like they have it, apart from redirecting each virtual host from the server's htdocs every time. Again, I'm a beginner at this, and I'd appreciate any help you could offer.