W
W
WhiteApfel2018-08-23 17:40:43
PHP
WhiteApfel, 2018-08-23 17:40:43

How to read uri (or url) and display it on the screen?

Suppose there is a site test.st. It is necessary to make it so that when you go to test.st/% some phrase%, a page with the inscription "% some phrase%" is displayed.
Even if it is a phrase in English, without spaces. As a possible solution, I see the issuance of some index.php on any request by nginx
, which would read uri (url) and display it using echo
But how to implement it - I have no idea
, the browser offers to download the contents of index.php (for example, when you go to test.st/lalala, it offers to download the lalala file, which, when opened with a text manager, shows the index.php code)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RidgeA, 2018-08-23
@RidgeA

is it possible without php
something like this

location ~ /(.*) {
  add_header Content-Type text/html;
  return 200 $1;
}

L
leni_m, 2018-08-23
@leni_m

echo $_SERVER['REQUEST_URI'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question