Answer the question
In order to leave comments, you need to log in
How to process all requests in one file on Apache?
I decided to write a small PHP application similar to how I did it on nodeJS. I chose MVC as a template, undertook to write a controller, but I ran into the fact that I can’t access the controller.php file with each request, since Apache (like other PHP-enabled servers) requests the file specified in the request path. I found on the Internet a seemingly solution to this problem using the .htaccess file:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ ./index.php?route=$1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question