I currently have an entire website running on PHP & GET variables.
My links look like this at present
http://www.example.co.uk/brochure.php?cat_path=24
And occasionally it has a second variable in the url…
I actually would like my URLs to look like this:
http://www.example.co.uk/Concrete_Fence_Posts
So my questions is simply, how do I go about rewriting urls without breaking my GET variables.
Thanks.
Assuming your parameters are always named
cat_pathandproduct_id(if it exists) you can do something like this:Your URLs would then be in one of these formats:
For example:
Edit: I see you want to use product names in the URL. In that case, your PHP scripts will need to be able to take a name as a parameter and look up the ID. You should continue to accept the ID directly so as to not break existing links. Then your rewrite rule would look like this:
And http://www.bentinckfencing.co.uk/Concrete_Fence_Posts would rewrite to http://www.bentinckfencing.co.uk/brochure.php?name=Concrete_Fence_Posts.