skip to Main Content

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.

2

Answers


  1. 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]
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search