Issue
I have two domains:
www.example1.com/ --> IP=1.2.3.4
www.example2.com/ --> IP=1.2.3.4 (same IP for both domains)
I want all requests that go to www.example2.com/*
to access the requested page.
I want all requests that go to www.example1.com/*
to redirect to www.example2.com/*
. How would I do this in apache? As now I am currently doing this in javascript.
Solution
put this code in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?example1\.com [NC]
RewriteRule ^ http://www.example2.com%{REQUEST_URI} [NE,R=301,L]
Answered By - anubhava Answer Checked By - Timothy Miller (WPSolving Admin)