I have a website that is migrated to another URL. So I wanted to migrate my all previous URL to a new URL with a different segment. For example
Main redirect
Old site is: https:// myoldsite.abc
New Site is: https:// mynewsite.xyzI also want to redirect all other pages to new URL
Old site is: https:// myoldsite.abc/myfolder
New Site is: https:// mynewsite.xyz/new_url_1Old site is: https:// myoldsite.abc/myfolder/old_url
New Site is: https:// mynewsite.xyz/new_url_2Old site is: https:// myoldsite.abc/myfolder/abc_url
New Site is: https:// mynewsite.xyz/new_url_3Simple URLs
Old site is: https:// myoldsite.abc/testing_url
New Site is: https:// mynewsite.xyz/New_testing_url_1
My code looks something like this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^myoldsite.abc [NC,OR]
RewriteCond %{HTTP_HOST} ^www.myoldsite.abc [NC]
RewriteRule ^/myfolder/url_1/?$ https://mynewsite.xyz/new_url_1 [R=301,L]
RewriteRule ^/myfolder/url_2/?$ https://mynewsite.xyz/new_url_2 [R=301,L]
RewriteRule ^/myfolder/url_3/?$ https://mynewsite.xyz/new_url_3 [R=301,L]
RewriteRule ^/myfolder/url_4/?$ https://mynewsite.xyz/new_url_4 [R=301,L]
RewriteRule ^/myfolder?$ https://mynewsite.xyz/new_url_4 [R=301,L,NC]
RewriteRule ^(.*)$ https://mynewsite.xyz [R=301,L]
</IfModule>
.htaccess
? However, the directives you have posted are as if you are in the main server config? How many redirects are required? Presumably the old URLs do not exist at the new site? Do both the old and new domains point to the new site? And both domains function OK on the new site - if it wasn't for the redirect? What is the difference between #2 and #3? How are your URLs being routed / what other directives do you have?