whats the total number of /s in:
q: mod_rewrite, clean urls, and page content directories i am using mod_rewrite in an .htaccess file in our root web directory so that we can use cleaner urls for some specific cases.  for example, we want to translate:
http://example.com/topic/abcd/type/description

into
http://example.com/topic.php?l=abcd&e=type&t=description

this seemed easy enough; the .htaccess file consists of:
rewriteengine on
rewriterule ^topic/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /topic.php?l=$1&e=$2&t=$3 [l]

however, all the pages content (.css files, images, etc.) ends up 404ing because instead of, say, loading /common.css from the directory relative to the rewritten url:
http://example.com/common.css

it loads it from the un-rewritten urls directory:
http://example.com/topic/abcd/type/description/common.css

which obviously does not exist.  however, ive found countless tutorials all over the web that advocate some variant on what im doing (one example here), but make no mention of this problem im having, so im wondering if theres just some configuration im overlooking.  they cant all rely on having these virtual directories exist and contain the pages content.  i also really dont want to make everything into absolute paths.
i have tried adding rules earlier in the .htaccess file to try to short-circuit content requests, such as:
rewriterule \.(css|jpe?g|gif|png)$ - [l]

but it seems to have no effect.  regardless, i wouldnt have thought such content would even match the original rule, as the regex in that rule does not allow for anything following the (optional) trailing slash.
if i change the rule such that its flag is set to redirect ([r,l] instead of just [l]), then it all works fine -- except now the browser displays the rewritten php parameter string, which is what we were trying to avoid.  in the past, weve just accepted this as a work-around, but now im trying to understand why its working this way, and what i can do about it.
in case its relevant, im using centos 6.2, and apache/2.2.15.

a: the problem is most likely that your code generates pages that include css like so:

<link rel=stylesheet type=text/css href=common.css />

since the browser sees this and sees the url it fetched as a subpath, it makes a request for common.css at that subpath.
you could (but shouldnt, for reasons ill explain in a moment) make some more rewrite rules that rewrite common.css etc to the single one at the top level, eg:

rewriteengine on
  rewriterule ^topic/([^/.]+)/([^/.]+)/([^/.]+)/common.css$ /common.css [l]  

however, that would be silly, since the whole point of css is to allow for caching etc. a much better approach is to simply add a / at the front of common.css in your code, so it produces css like so:

<link rel=stylesheet type=text/css href=/common.css />

that way, all the pages use the same common.css file, and the browser doesnt have to fetch a copy of the same file in multiple logical locations on every page, and whats more the browser knows to fetch it at the top level, not on a subpage.
ps jakub: the regex for the rewriterule already excludes anything with a period in it, which already covers the .css, .jpg, etc, so adding the additional rewritecond wont help.

a: you have to use rewritecond
rewriteengine on
rewritecond $1 !^(\.css|\.js|\.png|\.jpg)
rewriterule ^topic/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /topic.php?l=$1&e=$2&t=$3 [l]


a: the answer is relatively simple - you have to use base href in your html code because the process of rewriting the uri resets the base url which causes the 404s that you have been experiencing.
there is a good article on this at http://pixelcode.co.uk/tutorials/clean+urls+with+mod_rewrite.html
regards
miles

user
There are fifty-five "/"s.
assistant