Here is a very basic virtual host definition, with the focus being the rewrite rules. These rules direct all requests to index.php, except specified file types (.js, .ico, etc.):
Note the forward slash preceeding 'index.php'. These rules differ from .htaccess rules in that respect.
Again, these rules direct all requests to index.php, except specified file types:
Handling file and directory exceptions
These rules (used immediately prior to the RewriteRule above) exclude real files and directories from the rewriting and lets them pass through unaffected:
You can also simply allow a specified group of files to pass through unaffected by using this line:
In this case, files foo.* and bar.* will be accessed normally.
For more information, see Jayson Minard's Blueprint for PHP Applications: Bootstrapping.
Use ISAPI_Rewrite when using IIS. Add the following to the httpd.ini:
If your application is contained in a subdirectory, make sure to also set the correct RewriteBase.
To learn more about the ISAPI_Rewrite and its syntax, visit the ISAPI_Rewrite documentation.