S
S
Svoboo2019-03-31 17:19:29
htaccess
Svoboo, 2019-03-31 17:19:29

How to strip word from url using htaccess?

There are urls like:

site.ru/ejkwnfkjwe-test
site.ru/freferree-test
site.ru/hgfghg-test

It is necessary to make a redirect from them to the same ones, but without -test.
How can I do this with htaccess?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2019-03-31
@Svoboo

RewriteRule ^(.*)-test$ /$1 [R=301,L]
Or
RedirectMatch 301 ^(.*)-test$ $1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question