I want to use Apache mod_rewriteto be able to take each folder of the path as a specific request parameter, for example, consider the following:
Basic example
Url required: http://domain.com/shoes/prada/image-1/
Page: http://domain.com/?cid=shoes&bid=prada&pid=image-1
In this case the requested sub-folder 3 ( /shoes/, /prada/then image-1), so the first subfolder is transmitted to the actual page served as a cidsecond like bid, and the third - both pid.
Full example
However, I would also like it to serve a specific page depending on the number of subfolders requested, for example.
Url required: http://domain.com/shoes/prada/
Page: http://domain.com/shop.php?cid=shoes&bid=prada
So far, all I have managed to find is regular expression matching for mod_rewrite, but my path will be very different, so I would like to have conditions based on the number of folders available (note, m is not so good with regular expression - I I believe that a wildcard would help with this, but I would not be sure where to start).
Any help on this would be greatly appreciated! This is a pretty long wind, so if you need more information to clarify, let me know!
source
share