I need to redirect testdomain2.com/contact-us to testdomain1.com/contact-sales
How should I add redirection in IIS.
Website built in WordPress.
CodePudding user response:
There is couple of way you can do. In your function.php write this code.
if(is_page('contact-us')){
ob_start();
$url = 'testdomain1.com/contact-sales';
header('Location: '.$url);
ob_end_flush();
die();
}
This should redirect to your page.
CodePudding user response:
According to the description of your question, I did the following test:
I created two sites, one http-host is testdomain1.com and the other is testdomain3.com, then I use the URL-Rewrite module in IIS to create rewrite rules on a site whose http-host is testdomain3.
The following URL rewrite rule in the web.config file can give you a reference.
Test Results: When I enter the URL: testdomain3.com/contact-us/ in the browser, it will be redirected to testdomain1.com/contact-sales/
Of course, you can also refer to the following links to get more information on URL rewriting methods: