tokyosan
tokyosan

Reputation: 1

Redirecting full URL including directories

I'm migrating to a new website.

I want to be able to redirect everything from the old website to the new website in the following structure.

Example 1:

http://dev.website-old.com/abc/123

to

http://dev.website-new.com/abc/123

Example 2:

http://dev.website-old.com/abc/123/xyz

to

http://dev.website-new.com/abc/123/xyz

How do I accomplish this?

Upvotes: 0

Views: 10

Answers (1)

user10946716
user10946716

Reputation:

This rewrite redirect all requests (1:1) from dev.website-old.com to dev.website-new.com

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?dev\.website-old\.com [NC]
RewriteRule (.*) http://dev.website-new.com/$1 [R=301,L]

Upvotes: 1

Related Questions