View Full Version : Mod Rewrite - Apache

11-18-2007, 05:01 AM
I'm not the best at mod write, but I have 100+ options, and want to output it like this

etc etc..

Now should I be inputing "mister-mod" into my database, as is,

..or is that kinda *** backwards, as in I could just put in "Mister Mod" , and derive someway for apache to recognize & rewrite the variable?

Currently I've been using a number as the variable, but I want my url's as clean as possible, without having to write them all out by hand, on one of my new sites :p

11-18-2007, 06:03 AM

IF you want to use textual identifiers for your pages the easiest way is to put a textual indentifier in your database for each page. After that it is fairly straightforward if you follow the SE friendly URLs article on this site.

11-18-2007, 01:08 PM
Like Chris said, instead of using a numeric id to identify each page, you can use a text id and use mod_rewrite to make it search engine friendly.

So, if you have a table with this fields: id | page_name | content
You can now add a new text field: id | sef_id | page_name | content

The "sef_id" column will be your text id. Something like "mister-mod-for-sale".

Then your links will look like "domain.com/mister-mod-for-sale/" and you can use mod_rewrite and tell it to show any pages with that text id.