M
M
Maqsat Batyrqul2016-08-31 15:47:39
Nginx
Maqsat Batyrqul, 2016-08-31 15:47:39

How to combine multiple redirects into one NGINX?

https://baitrend.com///// -> https://baitrend.com/
Several redirects occur from this page, which gradually remove 1 slash from the url. It shouldn't be like that. The redirect should be only 1, removing all slashes from the url at once.
That's how SEO-shniks set us the task.
This code is gradually removed by 1 slash from the URL. How can I combine all slashes with one redirect?
rewrite ^/(.*)/$ /$1 permanent;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Entelis, 2016-08-31
@Maqsat

rewrite ^((?U).*)//+$ /$1 permanent;

A
Andrey Burov, 2016-08-31
@BuriK666

rewrite ^/(.+?/)/+$ /$1 permanent;
or maybe you need merge_slashes

S
sanzhar_nick, 2016-09-05
@sanzhar_nick

itblog.by/articles/47-nginx-ubrat-slesh-v-konce-ur...
searchengines.guru/showthread.php?t=814983
magilex.it/post/ybiraem_lishnie_sleshi_iz_adresa_u...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question