I basically want to rewrite any request starting with foo/ to foo/index.php?url=. For example, http://localhost/foo/something should become http://localhost/foo/index.php?url=something.
I currently have this rule:
RewriteRule ^foo/(\w*) foo/index.php?url=$1
This works on my localhost, but not on a free hosting service online. The point is, that it there also rewrites existing files… So my layout has gone, as well as all images etc, because foo/style.css becomes foo/index.php?url=style.css. This isn’t happening on my localhost.
I came across this similar question: mod_rewrite: Redirect if anything but a file, but it didn’t do anything actually.
So how would I go about rewriting anything except existing files here? Why does it only work on my own localhost?
If this does not work:
try this:
with added
$sign. But this doesn’t rewrite URLs with non-word chars like a dot (sofoo/style.csswont be rewritten).