Possible Duplicate:
How to redirect all requests to index.php and keep the other GET params?
Rerouting all php requests through index.php
Suppose we have /var/www/someapp/index.php
script. Now, how can we make Apache server send all of the requests for URLS like
http://somedomain.info/someapp/alpha
http://somedomain.info/someapp/beta
http://somedomain.info/someapp/beta/gamma
http://somedomain.info/someapp/epsilon/omega
...to that very index.php
script, and how can we retrieve the full path from inside that PHP script?
Typically this is done via rewrite rules (i.e. mod_rewrite on Apache). So for Apache that might involve modifying the conf file for the host, or applying the following in an .htaccess file in the web root (assuming the host config allows for such override)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^someapp/(.*)$ /someapp/index.php?q=$1 [L]
This would redirect the request to the index.php file (without changing the URL in the browser's location bar) and pass the query portion after 'someapp/' as parameter 'q' via GET to be made available in to the script, so long as the URI does not match an actual file or directory.