I'm writing a template for dreamweaver, and don't want to change the scripts for subfolder pages.
Is there a way to make the path relative to the root directory?
for example:
Instead of **root**
above, I want a default path there. Is there any way to do anything like this?
asked Apr 19, 2011 at 7:58
To be relative to the root directory, just start the URI with a /
answered Apr 19, 2011 at 8:01
QuentinQuentin
876k121 gold badges1172 silver badges1287 bronze badges
10
I recommend using the HTML element:
In this example, the stylesheet is located in //www.example.com/default/style.css
, the script in //www.example.com/default/script.js
. The advantage of over
/
is that it is more flexible. Your whole website can be located in a subdirectory of a domain, and you can easily alter the default directory of your website.
answered Mar 24, 2017 at 10:39
Alexander JankAlexander Jank
2,2201 gold badge16 silver badges19 bronze badges
2
/
means the root of the current drive;
./
means the current directory;
../
means the parent of the current directory.
Huy Nguyen
2,0153 gold badges24 silver badges34 bronze badges
answered Dec 7, 2016 at 6:55
MistyDawnMistyDawn
7877 silver badges8 bronze badges
Just start it with a slash? This means root. As long as you're testing on a web server [e.g. localhost] and not a file system [e.g. C:] then that should be all you need to do.
answered Apr 19, 2011 at 8:01
Lee KowalkowskiLee Kowalkowski
11.5k3 gold badges38 silver badges45 bronze badges
7
This is oddly confusing to me. I know it shouldn't be. To check my understanding, I'd like to use a family relations model to compare. Assuming "You" is the current webpage, is the following correct?
In your folder with you, like a sibling
In your child's folder, under you
In your parent's folder, above you
In your cousin's folder
So, up to parent, over to sibling, down to their child = your cousin, named "images".
answered Jun 22, 2018 at 22:40
1
As Alexander Jank mentioned is great. When using sub-domains e.g.
default.example.com
base works great, because the JS and CSS loads from the said sub-domain and is accessible to both default.example.com
and example.com/default
When using the root path, and
your JS and CSS files are located in example.com/css
, or example.com/js
, then the subdomain has no access and the root of the subdomain is not accessible, except using the base.
answered Feb 20, 2021 at 21:01
Use two periods before /
, example:
../style.css
answered Aug 8, 2015 at 5:45
1
You can use ResolveUrl
Rob♦
26.7k15 gold badges81 silver badges94 bronze badges
answered Dec 4, 2015 at 0:11
2