N
N
nano_e_t_42017-01-27 02:53:00
Apache HTTP Server
nano_e_t_4, 2017-01-27 02:53:00

How in Apache to give the specified file to any request?

Hello everyone
Plz tell me how to give the specified file to any request in Apache? In other words, is there an analogue of nginx: try_files in Apache?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Wolf, 2017-01-27
@Wolfnsex

Plz tell me how to give the specified file to any request in Apache?
This is how it works for me:
RewriteEngine On
RewriteRule ^(.*)$ luboy_file.txt [L]

There is also this option:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

It means something like this:
If the requested address is not a directory (i.e. such a directory does not exist) and if the requested address (URL) is not a file (i.e. such a file does not exist) then send all requests to the index.php file and stop further checking/execution of rules (flag [L]).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question