I am switching system from a MVC to a custom code system. Currently we are using this format for urls:
index.php?part=CAPACITOR&type=CERAMIC&model=0805&page=spec
I need now to rewrite urls like to be more nice for user like
mysitecom/CAPACITOR/
mysitecom/CAPACITOR/CERAMIC/
mysitecom/CAPACITOR/CERAMIC/0805/spec.html#2
where #1 and #2 are the pages loaded in jquery. The developer use the old way using /index.php/CAPACITOR/CERAMIC/0805/spec.html
Because I don’t think using the index.php in the url is good, what can I do to make this better?
Here’s what you need to use
So when a folder (example CERAMIC) is not provided you can add a flag to load all, same idea for model. It means that if only the first part is provided only he first rule will be used. As of the
page.htmlby default you can load the index.Now,
a-z0-9\-_means any letters, numbers, dashes and underscore ONLY. You can use([^/]+)if you prefer that will allow you to use more characters.The L mean
lastmeaning if the rule match, it will stop. NC means non case so A = a or ABC = abc.