Revision: 58966
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 11, 2012 17:02 by FatFolderDesigner
Initial Code
/* The .htaccess part */ Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] /* The PHP part */ $_urlvars = explode('/',$_REQUEST['url']); $_urlvars['_'.$k] = $v; foreach($_urlvars as $k => $v){ $_urlvars[$v] = (isset($_urlvars[$k+1])?$_urlvars[$k+1]:''); }
Initial URL
http://fatfolderdesign.com/653/php/perfect-php-htaccess-rewrites
Initial Description
These two snippets together, the first in the .htaccess file, and the second in your PHP create an elegantly simple solution to arbitrary URLs with php. For a breakdown and example check out the link. Don't want to follow the link, how about the quick version. The .htaccess redirects anything that doesn't exist to the PHP, where the script breaks it apart and places it all in the $_urlvars for your own uses.
Initial Title
Perfect PHP .htaccess rewrites
Initial Tags
php, htaccess, apache
Initial Language
PHP