Jump to content

Absolute paths supposed to work on Windows?


lenocin

Recommended Posts

For some reason I just never had to bother with absolute paths.  What I always did was create a "$level" variable at the top of each page, and set it according to the file's location  ('' if in root, '../' if one level in, etc).  Then I include files, css, etc by saying for instance "href=<?php echo($level); ?>css/main.css".

Above worked just fine for me a very long time (bit clumpsy I agree).

 

Lately I had to work with some code from others (and coincidently created on Mac, while I use Win)

These code will use href="/css/main.css", which just does not work on my setup (manual AMPP installation)

 

I read and looked into using <base>, but the only result and way to make absolute path's work, is if that site is directly in my root folder.  (By the way, all of this apply to work locally).

I use alias directories all over my computer (some work, some private) and set those in my http.conf with the alias directive.

 

Anyone can educate me a bit here? 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.