views:

15

answers:

2

Hello,

I am using php to develop an application, i have different set of url's if seo is enabled and different set if seo is disabled. ex:

  • SEO Enabled = hxxp://www.website.com/page/about_us
  • SEO Disabled = hxxp://www.website.com/page.php?about_us
  • Stylesheet url = hxxp://www.website.com/style.css

The problem is

If seo is disabled i have to use stylesheet url "style.css" whereas if seo is enabled i have to use url "../style.css"

Which is messed up, is there any way to get this done

// I know i can use variables / direct links..etc but is there any other way to do this like htaccess redirect or something..?

If you didn't understand my question, please comment i will explain more.

Thank You.

+1  A: 

No, you must avoid path-relative URLs when using routing/rewriting.

You don't have to use a full absolute URL, you can use a root-relative one, eg. href="/style.css".

Whilst in theory you could use a rewrite or alias to make /page/style.css also return the stylesheet, it'd quickly get ugly to cover every possibility, and the different URLs would mean less effective caching.

bobince
A: 

You can use /style.css, which will always resolve to http://website.com/style.css

Mike Sherov