This maybe a simple task, but I build sites in php locally and then upload them to a subfolder for clients approval. All this is fine, but when i’m building the site, I use references to the root, such as:
<link rel="stylesheet" type="text/css" href="/stylesheets/css/custom.css">
And when this is published to the site it is obviously a level to low. What would be the bet way (mainly for ease of life for me) to just upload files with-out having to remember to change the paths.
I did use
<? $root = "subfolder/"; ?>
<link rel="stylesheet" type="text/css" href="<?php echo $root;?>/stylesheets/css/custom.css">
But it seems a bit clunky… Hope this makes sense…
A very simple solution, you might not thought of:
Simply change the
/stylesheets/css/custom.csstostylesheets/css/custom.css( removing the first slash ) and then if you upload it to a subfolder it won’t mess up..The reason that this happens is that when you type
/in the first of a path it goes to the root automatically. So if your site is on the root then you might not have a problem but if it is on a subfolder than it will mess up…