Forum Moderators: phranque
for example, the website has 9 sections (some of them might be subsections of the other).
**This is a tree example**
www.mysite.com/about_us (db section_id = 1)
www.mysite.com/about_us/workteam/ (db section_id = 4)
www.mysite.com/about_us/employees/ (db section_id = 5)
www.mysite.com/products (db section_id = 2)
www.mysite.com/products/ice/ (db section_id = 6)
www.mysite.com/products/icecubes/ (db section_id = 7)
www.mysite.com/contact (db section_id = 3)
www.mysite.com/contact/phone/ (db section_id = 8)
www.mysite.com/contact/email/ (db section_id = 9)
What i need to do, is this:
www.mysite.com/about_us/employees/ ---> www.mysite.com/index.php?id_section=5
How can i achieve that?
I was reading another similar topic (http://www.webmasterworld.com/forum92/2907.htm) but that doesn't exactly work for my needs.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^([^/]+)/?$ /index.php?id_section=$1 [L]
... but of course that only works with one level. so, right know i need to find out how to:
1) how to get the number of directory identifiers --([^/]+)--
2) check consistency of identifiers. so that www.mysite.com/about_us/ice returns a 404 err