NYCPHP Meetup

NYPHP.org

[nycphp-talk] Mod_rewrite and pretty urls problem

Ajai Khattri ajai at bitblit.net
Tue Feb 5 11:40:11 EST 2008


On Tue, 5 Feb 2008, Cliff Hirsch wrote:

> For pretty urls, I have set up mod_rewrite like so:
> 
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^(.*)$ index.php?$1
> 
> For a page like www.domain.com/faq the controller captures the faq command
> and everything works fine.
> 
> But for www.domain.com/faq/ the images, css and javascript files are all
> missing. They are all set up as relative links. I¹m assuming that there are
> now relative to the /faq directory, which does not exist. Is this a
> side-effect of mod_rewrite? If so, how do you prevent it? Make all images,
> css and JS files absolute links or always relative to root?

You probably need to add a rule (or rules) before the one above (and also 
use L to shortcircuit the rest of the rules) when dealing with you faq 
folder and images/css.


-- 
Aj.




More information about the talk mailing list