How do I convert a PHP query string into a slash-based URL?
Simple .htaccess example: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^lookup/([a-z0-9\-]+)/item/?$ /lookup.php?id=$1 </IfModule> This will match any alphanumeric (also will recognise dashes) string of any length as the ‘id’. You can limit this to just numeric by changing the regex to ([0-9]+). <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^lookup/([a-z0-9\-]+)/([a-z0-9\-]+)/?$ /lookup.php?id=$1&view=$2 </IfModule> This one will match /lookup/123/some-text/ to /lookup.php?id=123&view=some-text