D
D
daniel_wesson2018-09-15 12:46:23
htaccess
daniel_wesson, 2018-09-15 12:46:23

How to redirect ALL requests to index.php in htaccess?

What needs to be written in htaccess so that everything that I wrote in the address bar is strictly redirected to the index.php file, which lies at the root, and then the controllers will decide what to give as a result. The problem is that I managed to redirect normal requests (for example https://domain/news/15) to index.php, but if I write something like this: http://domain/env/public_/view/assets /style.css, then the server, forgetting about index.php, immediately goes to look for this file in the specified directory. Or, for example, like this: http: //domain/engine/ in this case, all the ins and outs of the engine folder are opened to me, and index.php is again bypassed. Already tormented. I use openserver, Apache-PHP-7-x64+Nginx-1.12. Here is my htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.*)$ index.php/$1 [QSA,L]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
daniel_wesson, 2018-09-16
@daniel_wesson

Thanks everyone, removed nginx and everything worked

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question