0

i have 3 pages doctor.php , nurse.php , wardboy.php

currently the profile pages are like :

  1. /doctor.php?d=123
  2. /nurse.php?n=456
  3. /wardboy.php?w=789

what i am trying to get is all profiles on same page like -- /profile/123.php , /profile/456.php , /profile/789.php

I am using:

RewriteRule ^profile/([^/]*)\.php$ /doctor.php?d=$1 [L]
RewriteRule ^profile/([^/]*)\.php$ /nurse.php?n=$1 [L]
RewriteRule ^profile/([^/]*)\.php$ /wardboy.php?w=$1 [L]

only the first rule is working.

RavinderSingh13
  • 130,504
  • 14
  • 57
  • 93
  • 2
    Learn to think like a computer: you have been asked to serve some content for "/profile/123.php"; that's the only information you have. How do you choose whether to run "doctor.php", "nurse.php", or "wardboy.php"? You can't, and neither can Apache. – IMSoP Apr 25 '21 at 12:39
  • Can values d=123, n=456, w=789 have the same value or always different? – jacouh Apr 25 '21 at 14:09
  • Does this answer your question? [Reference: mod\_rewrite, URL rewriting and "pretty links" explained](https://stackoverflow.com/questions/20563772/reference-mod-rewrite-url-rewriting-and-pretty-links-explained) – IMSoP Apr 25 '21 at 14:43
  • @IMSoP u cleared my concept. Really very very thank you. – Rahul Chaurasia May 01 '21 at 12:27

0 Answers0