Busker McGreen Brian Busker McGreen Brian - 2 years ago 70
PHP Question

htaccess: RewriteRule for URL rewriting

I have a link that looks like this


I would like to change this URL to


I've only been able to do this by adding music as a parameter instead of adding it to the new URL as a prefix.
In short, i've turned this URL ...


... using this rule ...

RewriteRule ^([^/]*)/([^/]*)$ /artistmusic?address=$1&req=$2 [L]

... into ...


But the problem with this is that for other pages like the one for the videos, this rule redirects to the same page http://www.example.com/JKanyomozi/music instead of http://www.example.com/JKanyomozi/videos

The videos page's original URL is something like this ...


Which rule can I use to change the URL above to


This applies for other pages like artistevents, artistphotos and artistbiography

Thank you in advance!

Answer Source

Try this :

RewriteRule ^([^/]*)/([^/]*)$ /artist$2?address=$1 [L]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download