[Solved] How to call a specific PHP script for a set of paths? [duplicate]


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.

3

solved How to call a specific PHP script for a set of paths? [duplicate]