L
L
lexstile2020-03-03 21:16:50
htaccess
lexstile, 2020-03-03 21:16:50

Is there any way to remove duplicate sections from the url?

There is a url:

/produktsiya/reklamnaya-poligrafiya/broshyury/reklamnaya-poligrafiya/broshyury/broshjury-1-detail

Is it possible to make it like this:
/produktsiya/reklamnaya-poligrafiya/broshyury/broshjury-1-detail

But to do it dynamically, since we don't know which part will be duplicated...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-03-03
@lexstile

RewriteCond %{REQUEST_URI} ^((?>/([^/]+))+?.*?)/\2($|/.*)
RewriteCond %1%3           ^((?>/([^/]+))+?.*?)/\2($|/.*) [OR]
RewriteRule ^produktsiya/  %1%3 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question