Answer the question
In order to leave comments, you need to log in
Why can't I configure the location directive?
Hello dear experts.
I have nginx 1.14, the task is this: set up the location directive in the server block so that any request like site.com/ha_ha_ha, site.com/100500 or site.com/erfkgkiycblry/bugaga does not matter, it requests index.php
Here are the options that I tried and which do not work, when requesting the server, Content-Type: application/octet-stream is returned and the browser forces something to download.. :
location ~ / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /.+ {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /(.+) {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ ^/([^/]/)?.+ {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ ^/([^/]/)?(.+) {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /([^/]/)?.+ {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /([^/]/)?(.+) {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /[a-z]+ {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /([a-z]+) {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /\D+ {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /\d+ {
try_files $uri $uri/ /index.php?$query_string;
}
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