GreyBeard Inc.

    
     

Search Results in /dev/blog/

 


Clean URLs, mod_rewrite, and PHP

     Clean URLs are nice. And it's nice to be nice. So we always use clean URLs. Most rewrite examples found online look something like this:

RewriteRule ^topic/banana/$ filename.php?topic=banana

This puts an entry in the $_GET array with the name "topic" and the value "banana". Very nice. But it does not scale well.  For a big site with a lot of possible URL combinations the amount of rules can be problematic, and just a pain to keep having to adjust or add to. And unless I am mistaken, the more rules you have the more overhead for mod_rewrite (generally speaking). We have to within a web application or site analyze the URL arguments in PHP anyway, so using a more general type of rewrite regex we can use a nicer approach. The word for today by the way appears to be nice.