A
A
Alexey Kuznetsov2017-03-15 16:46:12
Nginx
Alexey Kuznetsov, 2017-03-15 16:46:12

How to rewrite url for server but not for client?

A little vaguely wrote the question. I don't know how to fit it in one sentence...
Actually, we have, for example, such a url
mydomain.com/ijkl/mnop
and here we needed to be allowed to substitute the abcd/efgh/ uri at the beginning. For example, like this:
mydomain.com/abcd/efgh/ijkl/mnop
At the same time, for the client, everything should remain as it is, no rewriting, and the server should understand this link like this:
mydomain.com/ijkl/mnop?abcd=efgh
And so for any link. Moreover, it is desirable to take into account that the initial link can also contain get-parameters. Help with config.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maikttt, 2017-03-15
@maikttt

I didn’t really understand what it means "... and the server should understand this link like this ..."
If the server means php, then in the server section of the nginx configuration for the site you add:
Now when you visit domain.com/var/value/test/url in php it will be domain.com/test/url?var=value

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question