'Redirect two links from old domain to new domain
I'm trying to redirect only 2 links from old domain to new domain not all links from old domain example :
https://old-domain.com/profile/teams to https://new-domain.com
and
https://old-domain.com/activities to https://new-domain.com
only this this two links
I did
RewriteEngine on
RewriteBase https://old-domain.com/profile/teams
RewriteRule (.*) https://new-domain.com [R=301,L]
RewriteEngine on
RewriteBase https://old-domain.com/activities
RewriteRule (.*) https://new-domain.com [R=301,L]
but I get 500 error
Solution 1:[1]
You can use this redirect rule on site root .htaccess of old domain:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www\.)?old-domain\.com$ [NC]
RewriteRule ^(profile/teams|activities)/?$ https://new-domain.com [L,R=301,NC]
Regular expression ^(profile/teams|activities)/?$ matches /(profile/teams or /activities followed by an optional trailing slash.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | anubhava |
