I have trouble with dynamic url spinning.
I've two different type of url’s that I have to rewrite for Search engine optimization reasons. Since these aren't fixed, but dynamic – I can’t just setup rules in htaccess as always. Additionally I in addition have a handful of fixed URL's.
All slug names are unique, and therefore are saved in 2 different tables during my database.
Product names (I've got a very big list of items) http://world wide web.domain.com/a-large-brown-bear.html (should indicate view_product.php)
Groups (The groups could be in 2 levels) http://world wide web.domain.com/cars/ford.html http://world wide web.domain.com/cars.html
(These should indicate view_category.php, and both degree of menu names ought to be sent along)
What’s the easiest way of controlling dynamic web addresses, while still depending on htaccess? Possible someone knows a category to make use of?
PS: My problem isn't writing the guidelines, but exactly how to fetch the guidelines from my DB into htaccess.
I’m afraid I’m causeing this to be more difficult that it truly is. All assistance is appreciated!
Thanks ahead of time,
You've basically two options:
Catch all incoming demands (aside from images, style sheets, etc.) right into a server-side front controller (PHP, ASP or whatever server-side language you utilize), and perform the redirection there using
header(....). This is actually the simplest and many popular way.
RewriteMapdirective to frequently write your maps into text files that mod_rewrite look up.
RewriteMap alternative may be advantageous in special omptimization situations with lots of traffic. Usually, odds are you are rich using the first option.