- Make a .htaccess file in your root directory.
- Put this code into it and customize the RewriteRule.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ http://127.0.0.1/dir/index.php [L]
Works perfectly on my localhost.