Anyone have experience with Apache's mod_rewrite for clean URLs? It strikes me as sort of...backwards, in a way. Perhaps not backwards, but more like a one-way street when you really want it to be two-way. For example, if you want it to map http://www.example.com/users.php?userid=324 to http://www.example.com/users/testuser, it's all well and good if someone clicks the latter as a hyperlink--the mapping performs as intended, and the user sees a clean URL. But say you passed in a query string to the URL via a form, in which case your URL is already (and unavoidably) going to be in the 'ugly' form. In this case, I want the clean URL to be displayed to the user. Can this be done using mod_rewrite? It seems to me that I have no choice but to implement (in conjunction with mod_rewrite) a redirect using regex in server-side code (PHP in my case), which will then produce the clean URL.
If I'm missing something in mod_rewrite (which I'm very new to), please let me know. I'd like to implement this functionality just in Apache if possible without touching the application layer.
If I'm missing something in mod_rewrite (which I'm very new to), please let me know. I'd like to implement this functionality just in Apache if possible without touching the application layer.