0

I have the following URL: www.mydomain.com/musician.php?musician=musicianname&id=idnumber

I am using mod_rewrite to achieve this: www.mydomain.com/musician/musicianname/idnumber

This is the rule I am using:

RewriteRule musician/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ /musician.php?$musician=$1&id=$2 [L]

This is working just fine but I want to make this URL more user friendly. I would like to hide "musician" and "idnumber" from the url and have only "musicianname": www.mydomain.com/musicianname/

What is the best mod_rewrite rule to achieve this?

  • i think you have to change the code to be able to restore a request using musicianname, how do you want to create the id from musicianname? there a way using env variable to store them, but it will be complicated for nothing – Froggiz Oct 26 '15 at 14:17
  • @Froggiz musicianname is not unique. I cannot query my db using that string. – Gabriel Ferraz Oct 26 '15 at 14:18
  • so you can't generate the id from the musicianname, you have to find something outside apache (like php session) but becarefull to multiple browser used by the same user. – Froggiz Oct 26 '15 at 15:01
  • @Froggiz that will start getting a bit messy. I will keep working on it. Thanks! – Gabriel Ferraz Oct 26 '15 at 15:04

0 Answers0