I’m having this issue which I can’t figure out, I’d like to use mod_rewrite to do the following:
http://localhost/The+Beatles
into
http://localhost/artist.php?a=The+Beatles
I’ve tried following some examples on here and other sites and tayloring it to my needs I’m come up with the following but it’s not working:
RewriteEngine on
RewriteRule ^(.*) artist.php?a=$1
It seems to set the a variable to artist.php which I can’t seem to figure out? Hope someone can help.
Dave
You could try this set of rules (adapted from a vanilla Zend Framework project)
This will rewrite requests for non-existent files to your
artists.phpscript whilst leaving normal requests for images, stylesheets, JavaScript, etc alone.In your
artist.phpscript, you simply access the original request via the$_GET['a']variable.