Path and Entry Template problems when developing locally I feel this a simple problem to fix, but I can't find an answer anywhere.

I am developing locally on using MAMP.

Everything on my site is working great until I call up page using a template inside a folder inside the templates directory. At that point the paths are broken to any and all assets (CSS, images, etc.)

For example, if I set the Entry Template for a section in Craft to say news/_entry and then view a news article page... I get an un-styled page.

I am including the CSS like this:



&lt;link rel="stylesheet" href="../public/assets/css/nav.css"&gt;


and the images like:

&lt;img src="../public/assets/images/swf_logo.png" alt="" /&gt;
Your image/CSS/JS URLs should be either absolute, protocol-relative, or root-relative:



&lt;!-- absolute --&gt;
&lt;link rel="stylesheet" href="http://example.com/assets/css/nav.css"&gt;
&lt;img src="http://example.com/assets/images/swf_logo.png" alt="" /&gt;

&lt;!-- protocol-relative --&gt;
&lt;link rel="stylesheet" href="//example.com/assets/css/nav.css"&gt;
&lt;img src="//example.com/assets/images/swf_logo.png" alt="" /&gt;

&lt;!-- root-relative --&gt;
&lt;link rel="stylesheet" href="/assets/css/nav.css"&gt;
&lt;img src="/assets/images/swf_logo.png" alt="" /&gt;


Relative URLs (which start with either ./, ../, or no slash at all) are generally a bad idea, since the URL will need to vary depending on the number of segments in your URI.

For example if you were to access http://example.com/, the relative path to your nav.css would be assets/css/nav.css, but if you were to access http://example.com/about/ (with a trailing slash), then the proper relative URL would be ../assets/css/nav.css.

That’s not to say that relative URLs are impossible. The main issue with your URLs is not that they’re relative, it’s that you’re treating them as relative from the physical template file location. Keep in mind that these front-end resource URLs are resolved by the browser, not by the server, and browsers have no idea how the resulting HTML gets generated, let alone that it came from a template that happened to live a couple directories up from your web root, and in a craft/templates/... subfolder. So they need to be relative based an the apparent location of the webpage, as defined by its URI (e.g. “/news/some-slug”).