Forum Moderators: phranque
I want convert url from
www.example.com/artist.php?artist=John Smith
to
www.example.com/JohnSmith/
RewriteCond %{QUERY_STRING} ^artist\=([^&]+)$
RewriteRule ^$ /artist/%1-%2.html [R=301,L]
[edited by: jdMorgan at 2:49 am (utc) on Mar. 1, 2006]
[edit reason] Reformatted using [ code ]. [/edit]
Your code does not agree with your description of your goal. The code will only work for the index file. That is, the pattern "^$" will reject any local URL-path that is non-blank.
Actually, I suspect the problem is deeper. If you wish to use static, search-engine-friendly URLs on your site, then the following procedure should be used:
mod_rewrite is not an output filter. It operates in the URL-to-filename translation phase early in the request-handling process. It is used to modify URLs requested from your server before any content-handlers are invoked and before any scripts are executed. It cannot change the URLs displayed on your pages.
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim