s,
You missed the one critical point at the beginning: YOU create the new format for the link and let mod_rewrite redirect to the servable URI.
What does mfone serve? My guess is NOTHING!
Drop back 10 but don't punt - PLAN! If you want cat/IBM as the URI (cat would be necessary only if you want to have other links to redirect), it's easy to create regex to catalog/index.php?manufacturers_name=IBM. If you prefer to use the IDs, then CREATE YOUR LINKS LIKE cat/90 but that's hardly an improvement, is it? One point here is that the NEW URI needs to contain the information to use to convert it to the REAL URI.
Code:
RewriteEngine on
RewriteRule ^cat/([a-zA-Z_]+)$ catalog/index.php?manufacturer_name=$1 [L]
Notice the direction of the redirection?
I seem to remember (Or am I losing it? Oh, better not answer that question!) that you also want to redirect TO the new format. That would add (before or after) the above RewriteRule:
Code:
RewriteCond %{IS_SUBREQ} ^false$
RewriteCond %{QUERY_STRING} manufacturers_name=([a-zA-Z_]+)
RewriteRule ^catalog/index\.php$ cat/%1 [R=301,L]
Yes, I do have a hang-up about using names or titles or ... rather than digits to use to query the database. Just make sure that whatever you use is UNIQUE (which can be enforced by MySQL) in the database.
Another thing you (might have) missed is that Apache 1.x requires ^/ but Apache 2.x requires only ^. To allow either to match, you need to use ^/?. Because there are so few Apache 1's left in the wild, I assumed Apache 2 in my code.
Please REread the tutorial as that should make the above code obvious.
Regards,
DK
Bookmarks