My .htaccess code below is giving unexpected results. Please help me to fix this by referring expected result vs output result.
<IfModule mod_rewrite.c>
Redirect /main-page https://example.com/new-main-page
Redirect /main-page/sub-page1 https://example.com/new-main-page/new-sub-page1
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
## Added as per WP-1252 ##
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=edge"
</IfModule>
Expected Behavior:
Request 1: https://sample.com/main-page redirect to https://example.com/new-main-page
Request 2: https://sample.com/main-page/sub-page1 redirect to https://example.com/new-main-page/new-sub-page1
Request 3: https://sample.com/main-page/sub-page2 redirect to https://sample.com/page-not-found
Output Result:
Request 1: https://sample.com/main-page redirects to https://example.com/new-main-page (Expected Behavior)
Request 2: https://sample.com/main-page/sub-page1 redirects to https://example.com/new-main-page/new-sub-page1 (Expected Behavior)
Request 3: https://sample.com/main-page/sub-page2 redirects to https://example.com/new-main-page/sub-page2 (Unexpected Behavior. Why?)