Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

CodeIgniter and many other PHP frameworks rout URLs, e.g. if default controller is root.php then both URLs will work


if controller has a function 'login' then this URL is valid


This is very handy, 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 I have to use

<link rel='stylesheet' href='../stylesheets/style.css'/>

Is there a way around it?

share|improve this question
up vote 5 down vote accepted

If you make the styleshhet path relative to the rooot directory of the site I would think it would work in both cases, i.e.

<link rel='stylesheet' href='/stylesheets/style.css'/>
share|improve this answer
When the path is "relative to the root directory" it is called an absolute path. – danlefree Nov 7 '11 at 17:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.