Answer the question
In order to leave comments, you need to log in
How to accept http requests?
Through htaccess I send all requests to index.php RewriteRule ^(.*)$ index.php [L,QSA]
Now in index I need to accept and process them somehow. How to take them?
The result should be a list of all sent requests, including pictures, styles, etc.
Answer the question
In order to leave comments, you need to log in
I think it's not a secret for you that all requests for styles, pictures, etc. this is not one big request, but each resource is requested separately.
You can see the list of all requests in Apache's access.log, or whatever you have there. Static is usually given by means of a web server (nginx, apache) without pulling php for this.
The approach where all requests (or all requests to non-static files) are redirected to one php file is called " single entry point ", there are a lot of articles on the net describing how to do this.
In short:
#кусок из symfony
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /app.php [QSA,L]
Parse the global variable $_SERVER["REQUEST_URI"] and dance from it.
Get it out first
<?php
echo $_SERVER["REQUEST_URI"];
?>
Images and all sorts of resources are better not to send to index.php
in index.php :var_dump($_SERVER);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question