This simple code snippet, if placed into an .htaccess file, would rewrite an alphanumerical “tail” of a URL into a variable accessible to an index.php residing in the same directory:
RewriteEngine On RewriteRule ^([a-zA-Z0-9]+)$ index.php?tail=$1
For example, let’s say the the two files reside inside this directory:
Then, a user accessing this URL:
would see the output of this script:
Note that the “tail” must be alphanumerical (i.e., contain only letters and numbers).