It is typical to use the front-controller pattern to funnel appropriate HTTP requests received by your web server to a single PHP file. The instructions below explain how to tell your web server to send HTTP requests to your PHP front-controller file.
Run the following command in terminal to start localhost web server,
./public/ is public-accessible directory with
If you are not using
index.php as your entry point then change appropriately.
index.php files are in the same
public-accessible directory. The
.htaccess file should contain this code:
Make sure your Apache virtual host is configured with the
so that the
.htaccess rewrite rules can be used:
This is an example Nginx virtual host configuration for the domain
It listens for inbound HTTP connections on port 80. It assumes a PHP-FPM server
is running on port 9000. You should update the
root directives with your own values. The
is the path to your application’s public document root directory; your Slim app’s
index.php front-controller file should be in this directory.
Your HipHop Virtual Machine configuration file should contain this code (along with other settings you may need). Be sure you change the
SourceRoot setting to point to your Slim app’s document root directory.
index.php files are in the same public-accessible directory. The
Web.config file should contain this code:
Your lighttpd configuration file should contain this code (along with other settings you may need). This code requires lighttpd >= 1.4.24.
This assumes that Slim’s
index.php is in the root folder of your project (www root).