SEO URL parse
In working on a number of different web projects, I’ve had to create search-engine friendly URLs (I.E. ‘dxmio.com/blah/bleh’, instead of ‘dxmio.com/?x=blah&y=bleh’. The way to accomplish this seems to be with .htaccess and mod_rewrite sending everything to a base controller, like ‘index.php’. This of course leaves one very big problem which may not be completely obvious to begin with. What if you have _GET variables passed in? Parsing a url by delimiting things with ‘/’s will not take into account these items. A solution I’ve developed:
function uri2gets($uri) { $uri = explode("?", $uri); $gets = explode("&", urldecode($uri[1])); foreach($gets as $get){ $parts = explode("=", $get); $_GET[$parts[0]] = $parts[1]; } return $_GET; }