i have decided to start using SEF urls on a project which is quite large already.
so i’m thinking of converting urls like so.
http://localhost/browse.php?cat=people
into
http://localhost/category/people/
so i added a RewriteRule to htaccess and Voila the url works but all my css, js, images, links are broken because i have used relative paths throughout the site.
ie. assets/css/styleshheet.css rarther than http://localhost/assets/css/styleshheet.css
So my question is do you have to use absolute paths throughout your entire site when using SEF urls or is there a trick?
If not, what’s the coolest way to implement it?
Routing jpg gif png js and css to specific folders through htaccess is a very bad idea. Kills your flexibility and soon you will have thousands of rules defined this way 😀
You can define base url of the document like this (put in head section)
or better start using absulute paths for everything. (IMG sources Link URLs etc.)
For instance WordPress uses absolute links which is also called permalinks.