Folder as parameter in PHP

php

Solution

I think using htaccess is a solution.

RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php?$1 [L]

That one will rewrite url not followed by index.php, images or robots.txt to /index.php?{DIR OR VARS}

Problem

I want to create a script that pass every folder requested in a website as a parameter. For example, if someone requests: ``` www.example.com/foo ``` ...that will be redirected to the main index.php and passed as a parameter, getting the same result when requesting `www.example.com/index.php?foo` Please note that the folder requested will be random so i can't predict the folder and put a php script there. Should i handle all the 404 requests through HTACCESS? Or there's a fancier solution?

Original source