/ Published in: PHP
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.
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* 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['_'.$k] = $v; foreach($_urlvars as $k => $v){ }
URL: http://fatfolderdesign.com/653/php/perfect-php-htaccess-rewrites