How to make a parametric redirect from one subdomain to another?

0 like 0 dislike
124 views
Good day!
There is a need to do a redirect from one subdomain to another (transferring materials).
Is there an url https://poddomen1.site.ru/2019/01/ and https://poddomen1.site.ru/2019/01/post.html?m=0
1. https://poddomen1.site.ru/2019/01/ should be moved to the root of the second subdomain https://poddomen2.site.ru
Understand that enough rules
Redirect 301 /2019/01/ https://poddomen2.site.ru/


2. https://poddomen1.site.ru/2019/01/post.html?m=0 contains a particular post, which is on the second subdomain, but with CNC the kind of https://poddomen2.site.ru/statya
Tell me, how to do a redirect for the second case?

P. S. was thinking about
RewriteRule ^(.*)/ /2019/01/post.html?m=0 /(.*)$ $1/ https://poddomen2.site.ru /$2 [R=301,L]
but it didn't.
by | 124 views

1 Answer

0 like 0 dislike
Redirect 301 /2019/01/ https://poddomen2.site.ru/ RewriteRule ^(.*)/ /2019/01/post.html?m=0 /(.*)$ $1/ https://poddomen2.site.ru /$2 [R=301,L]


RewriteEngine On RewriteRule ^2019/01/$ https://poddomen2.site.ru/ [R=301,L] RewriteCond %{QUERY_STRING} =m=0 RewriteRule ^2019/01/post\\.html$ https://poddomen2.site.ru/statya? [R=301,L]
by
110,608 questions
257,187 answers
0 comments
40,796 users