C
C
Cerebrumlab2018-08-20 14:06:37
Nginx
Cerebrumlab, 2018-08-20 14:06:37

How to make a page redirect in nginx?

There is a directadmin on the server, there is a redirect there, but you need to add 1 page at a time, but how to make a config for nginx so that you can redirect from the old to the new url? in total about 1500 urls all changed accordingly how to make a config for everyone?
I do this
rewrite /categoryold/oldurl /categorynew/newurl permanent;
All the time the error is that there is not enough 1 argument, I also tried these configs
rewrite ^(/categoryold/oldurl) /categorynew/newurl permanent;
rewrite ^/categoryold/oldurl /categorynew/newurl permanent;
tried it like this
location /categoryold/oldurl {
rewrite ^(.*) /categorynew/newurl permanent;
}
If anyone knows the manual I will be very grateful

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question