NYCPHP Meetup

NYPHP.org

[nycphp-talk] Mod_rewrite and pretty urls problem

John Campbell jcampbell1 at gmail.com
Tue Feb 5 12:01:18 EST 2008


>  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?

Make images, javascript and css relative to root.  This is standard
practice.  Put the css/javascript in a folder with gzip turned on, and
the images in a folder without gzip.

>  Also, what is the proper RewriteRule to preserve get query variables?
>
>  Something like RewriteRule ?(.*)$ index.php?$1

Just use add [QSA] (Query string append) to the end.
RewriteRule ^(.*)$ index.php?req=$1 [QSA]

-John C.



More information about the talk mailing list