Forum Moderators: phranque
I'm curious if I should build the site now, and then implement the Mod-Rewrite stuff, or if I should implement the mod-rewrite while building the site.
Is mod rewrite easy to implement after the php database driven site is in place?
There are any number of ways to create static-looking links for a dynamic site. You can use fixed-length fields, key-characters (such as "/" as suggested above), alternating numbers and letters, or anything that will allow mod_rewrite to figure out where the parameter boundaries are so as to reliably map your static URL to your dynamic URLs.
If you're worried about it looking funny, you can even tack a nice ".html" on the end.
As an example, WebmasterWorld is a dynamic site; Examine the URL in your address bar right now for an example of a static URL for a dynamic site. Is it spammy? No. And there are a lot of WebmasterWorld pages indexed in the search engines!
When choosing a URL "architecture," make sure that it is unambiguous and that it grows well. You don't want to have to change it later because your site grows quickly or in an unexpected way.
And as WhosAWhata stated, your script needs to output friendly addresses on your pages. When a user/browser requests one of these friendly URLs, mod_rewrite can be used to convert it back to a dynamic format for use by your script. Alternatively, you can use mod_rewrite to call your script unconditionally, and the script itself can convert the URL as needed to generate or retrieve page content. Mod_rewrite works after an HTTP request is received by Apache, and before any content is served; It cannot change URLs output by a script, because it only works "on the input side." Therefore, the pages output by your script must contain friendly URLs.
Jim
[webmasterworld.com...]