N
N
Nick Bukovskiy2017-03-20 11:18:46
PHP
Nick Bukovskiy, 2017-03-20 11:18:46

How to configure openserver to redirect every request to index.php?

With server settings on linux, you can make sure that all requests are redirected to one file that would process them and give the desired answer. An example is the implementation of site routing. How to make these settings on openserver and is it possible?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-03-20
@sonterix

Just like everywhere else. Throw in the root of the public folder .htaccess, for example with the following content:

RewriteEngine on

# это по вкусу конечно, скрываем ряд папок
RedirectMatch 404 /\.git
RedirectMatch 404 /composer\.
RedirectMatch 404 /.bowerrc

# Это что б реальньно созданные файлы не редиректились
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# редиректим на него родного
RewriteRule . index.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question