D
D
Dmitry Nosikov2016-10-12 13:11:38
Apache HTTP Server
Dmitry Nosikov, 2016-10-12 13:11:38

How to make a correct 301 redirect with saving all parameters in the url?

Good afternoon, colleagues! I ask for help, because I fight with a redirect for the second day.
The essence of the question is this:
The site currently has a section /zdorove/, articles that are in this section are opened by a link of the form /zdorove/britanskim-medikam-udalos-pobedit-spid/. Articles from this section I have moved to a new section /news-new/. I need to redirect to the corresponding article in the new section ( )
when entering the page /zdorove/ редиректило на /newss-new/, and when additionally transferring the article ( ), etc. I hope I didn't explain too hard. Tried the rule:/zdorove/britanskim-medikam-udalos-pobedit-spid//news-new/britanskim-medikam-udalos-pobedit-spid/

RewriteRule ^/zdorove/(/.*|)$ http://gu.my/news-new/$1 [L,NC,R=301]
, but, unfortunately, when entering the address
http://gu.my/zdorove/britanskim-medikam-udalos-pobedit-spid/
this rule stupidly redirects me to a new section http://gu.my/news-new/without saving the article passed to the url. In advance, many thanks to all who responded.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton fon Faust, 2016-10-12
@deimon260993

For example, like this:

RedirectMatch 301 zdorove(\/)?(.*)$ http://gu.my/news-new/$2

D
Dmitry Nosikov, 2016-10-12
@deimon260993

Unfortunately, the same result ( Inserting the link /zdorove/britanskim-medikam-udalos-pobedit-spid/ redirects to /news-new/. I
figured out what the problem was. Your solution really helped, thanks a lot. The whole question was included directive Options +FollowSymLinks .As soon as I disabled it, everything began to work properly.I will figure out why it does not work with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question