I have a FrontController
expecting two $_GET
params:
controller
action
A typical call to the site would look like thi
There are 2 parts to getting this working. If you are working with PHP and Apache, rewrite engine must be available on your server.
In your user folder put a file named .htaccess
with these contents:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
Then your index.php
you can use the REQUEST_URI
server variable to see what was requested:
If someone requested /start/register
, then assuming all the above code is in the html root, the $path
variable would contain start/register
.
I'd use the explode function on $path
using the /
as a separator and pull the first element as register.
The rewrite code has the benefit of working with filenames and directory names.