Simple(?) Rewrite rule for PHP website navigation ie "domain.com/artists" instead of "domain.com/index.php?n=3"
Posted on 2006-07-19
I have a ton of websites that are driven by a mysql table for the nav, structured so that every page references the index.php, which includes a content page based on the nav variable passed in. So if a website has three sections like "artists", "news", and "publications", a nav table holds
nav_id ; nav_name
1 ; arists
2 ; news
3 ; publications
and the URLS look like:
How hard is it to use a rewrite rule so that I don't have to change CODE, and these sites can still work this way, but the the pages could be called up with
And the URL STICK on that (ie not meta refresh to index.php?n=1 etc..)?
This has become more important obviously with search engine optimization, but obviously I'm looking for the simplest way to upgrade legacy sites.
- I hear rewrite rules can be incredibly complicated. Since my structure is so consistent accross so many sites, can someone give me an idea of how "simple" my situation is? What's the easiest way for me to learn how to do this - can someone point me in the right direction? Linux redhat apache cpanel php/mysql environment
- BTW is this actually that important to search engine optimization or is it just an aesthetic / user friendly thing?
- I do sometimes have subnavigation, so there are two navigation variables, requiring two directories like /news/archived and news/current or something to that effect..
Thanks for any help - basically I'm very familiar with php/mysql and work at the shell but don't know c++ etc. and wondering if someone can guide me to the best solution and most efficient way for me to learn how to do it, whether it's a recommended book, web tutorial, sample code, etc..