Description of the 301 redirect process to subdomains in X SERVER (.htaccess)

Asked 2 years ago, Updated 2 years ago, 85 views

I have a question about the .htaccess description on the site where XSERVER is running.

What you want to do (two redirects to each subdomain and a uniform URL)
·301 Redirect to https://example.com/aaa/https://new.exmaple.com/aaa/ ·301 Redirect to https://example.com/bbb/https://new.exmaple.com/bbb/ ·301 redirect to https://example.com/new/https://new.exmaple.com/

Challenge:
Although example.com/.htaccess describes the following, some browsers do not redirect or only the first /aa/ is redirected.

#BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule^index\.php$ - [L]
US>RewriteCon%{REQUEST_FILENAME}!-f
RewriteCon%{REQUEST_FILENAME}!-d
RewriteRule./index.php [L]
RewriteCond%{REQUEST_URI}^/aaa.*$
RewriteRule^.*$https://new.example.com/aaa [R=301]
RewriteCond%{REQUEST_URI}^/bbb.*$
RewriteRule^.*$https://new.example.com/bbb [R=301]
</IfModule>

# END WordPress

Redirect permanent/new/https://new.example.com/

Added to default WordPress description.

#BEGIN WordPress 
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule^index\.php$ - [L]
US>RewriteCon%{REQUEST_FILENAME}!-f
RewriteCon%{REQUEST_FILENAME}!-d
RewriteRule./index.php [L]
</IfModule>

# END WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond%{REQUEST_URI}^/aaa.*$
RewriteRule^.*$https://new.example.com/aaa [R=301]
RewriteCond%{REQUEST_URI}^/bbb.*$
RewriteRule^.*$https://new.example.com/bbb [R=301]
</IfModule>

The redirect was not reflected when I changed the description to the one above.
I have cleared the cache and checked it.

.htaccess

2022-09-30 11:59

1 Answers

I was curious about something that had nothing to do with the question.

#BEGIN WordPress

and

#END WordPress


Because WordPress may rewrite what is listed between
I think it would be better to write anything other than the one written automatically in WordPress.


2022-09-30 11:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.