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? 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.