Let’s say, the default controller is root.php then both URLs will work
website.com/
website.com/root
if controller has a function named login then this URL is also valid
website.com/root/login
but the HTML template that used to work in first example, doesn’t work in the second, e.g. this relative path is no longer valid
<link rel='stylesheet' href='stylesheets/style.css'/>
and instead for website.com/root/login I have to use a different path
<link rel='stylesheet' href='../stylesheets/style.css'/>
even though I’m in the same controller and trying to use the same stylesheet.
Is there a way around it?
It is because the browser is looking for the stylesheets relative to the url in the address bar.
so the in the case of the first stylesheet in the second url, ie:
The browser is looking for the file at
Which is not where the files are kept. I assume they are actually at
website.com/stylesheets/styles.css.The easiest way around this is to simply make all the paths relative to the root of the website.
so if you try this, you should find that it works.