Redirect a Domain without Changing the URL with htaccess rule

2023-05-14 · Uncategorized

Redirect and keep everything after the URL

RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) https://DomainB.com/$1 [P]

Redirect a domain to a specific url

RewriteCond %{HTTP_HOST} ^DomainA.com
RewriteRule ^(.*) https://DomainB.com/PathToPageHere [P]

Redirect an IP address

# Redirect all IP address (replace the ## with the IP address numerals) to same https://domain_name.com
RewriteCond %{HTTP_HOST} ^##.##.##.##
RewriteRule (.*) https://domain_name.com/$1 [R=301,L]

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.