Quite new to this mod rewrite stuff, still getting my head around it all.
What I am trying to do is change the following URL
- Code: Select all
http://www.example.com/browse-retail-jobs/jobs.php?location=55&job_title=32&job_id=75
to
- Code: Select all
http://www.example.com/retail-jobs/xx/xx/xx/L55JT32ID75.html
(L = location, JT = job_title, ID = job_id)
The xx will be various keywords that I choose depending on the options that have been selected, I can work this out using php.
I have
- Code: Select all
RewriteRule ^retail-jobs/.*/L([0-9]+)JT([0-9]+)ID([0-9]+).html$ /browse-retail-jobs/jobs.php?location=$1&job_title=$2&job_id=$3 [NC,L]
This works fine, but I want to be able to miss out any of the parameters or pass them in any combination.
- Code: Select all
http://www.example.com/retail-jobs/xx/xx/xx/JT32ID75.html
job_title = 32, job_id = 75.
http://www.example.com/retail-jobs/xx/xx/xx/L55ID75.html
location = 55, job_id = 75.
http://www.example.com/retail-jobs/xx/xx/xx/ID75.html
job_id = 75.
I have tried various options but I either get stuck in a loop or end up creating 30+ rules??
Please can anyone point me in the right direction on how to achieve this.
Thanks for your help!!
Shaun