D
D
Denis99992021-12-21 18:27:51
htaccess
Denis9999, 2021-12-21 18:27:51

How to set up a redirect for these links to the corresponding ones without www?

Can you tell me how to set up a redirect for these urls to the corresponding ones without www?
- https://www.example.com/wp-content/uploads/2020/11...
- https://www.example.com/feed/?C=N;O=D
- https://www .example.com/feed/?C=M;O=A
- https://www.example.com/feed/
- https://www.example.com/feed/?C=M;O=D

Yes working code:

RewriteCond %{HTTP_HOST} ^w\-dprint\.ru$
RewriteRule ^plotternaya\-rezka$ https://w\-dprint.ru/? [L,R=301]


But it just redirects from https://example.com/plotternaya-rezka to the main https://www.example.com/ page . By analogy, I can’t do it, since apparently some characters need to be escaped .. in the working example, a dash is escaped, maybe a semicolon needs to be escaped or a slash?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2021-12-22
@shambler81

RewriteCond %{HTTP_HOST} ^www\.w\-dprint\.ru$
RewriteRule ^wp\-content/uploads/2020/11/Presentation\-GG\.pdf$ https://w\-dprint.ru/wp\-content/uploads/2020/11/Presentation\-GG.pdf? [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.w\-dprint\.ru$
RewriteCond %{QUERY_STRING} (?:^|&)C\=N;O\=D(?:$|&)
RewriteRule ^feed/$ https://w\-dprint.ru/feed/?C=N;O=D [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.w\-dprint\.ru$
RewriteCond %{QUERY_STRING} (?:^|&)C\=M;O\=A(?:$|&)
RewriteRule ^feed/$ https://w\-dprint.ru/feed/?C=M;O=A [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.w\-dprint\.ru$
RewriteRule ^feed/$ https://w\-dprint.ru/feed/? [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.w\-dprint\.ru$
RewriteCond %{QUERY_STRING} (?:^|&)C\=M;O\=D(?:$|&)
RewriteRule ^feed/$ https://w\-dprint.ru/feed/?C=M;O=D [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question