D
D
dannying2018-03-21 21:41:10
htaccess
dannying, 2018-03-21 21:41:10

How to write a redirect from one section to another?

there is such a structure
example.com/news/article-1
example.com/article/news/article-1

you need to make sure that all pages that belong to example.com/news are redirected to example.com/article/news and at the same time, this page example.com/news should not be redirected
there is such a rule

RewriteRule ^pagarnaia_i_evecuacionnaia_lestnica(/?)(.+)?$ /portfolio2/pagarnaia_i_evecuacionnaia_lestnica1/$2 [R=301,L]

it works, but the page pagarnaia_i_evecuacionnaia_lestnica still redirects

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-03-22
@shambler81

RewriteRule ^news/(.+)$ /article/news/$1? [L,R=301]

(.+)- one or more times
$1- the first parenthesis from the rewrite rule - will
?remove the get parameters if they exist

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question