I want to change/redirect URIs with http/https in this way:
from:
http:// or https://xyz.lastdomain.com/b/custom/any-string/456?foo=bar
to:
https://custom.nextdomain.com/b/any-string/456?foo=bar
the custom string should be in the new URL and everything from b so as the end of the URI should be appended.
I appreciate your help very much.
Could you please try following, considering that your htaccess file and custom folder are in root location.
RewriteEngine ON
RewriteCond %{REQUEST_URI} !custom [NC]
RewriteRule ^(.*)$ https://custom.nextdomain.com/custom/$1 [L]
You ma try this redirect rule from old site's .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^xyz\.lastdomain\.com$ [NC]
RewriteRule ^b/([\w-]+)/(.*)$ http://$1.nextdomain.com/b/$2 [L,NC,R=301,NE]
This assumes all the paths start with /b/
right after the domain name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.