I want to set DNS redirect for site | Community
Skip to main content
Level 2
December 7, 2022
Solved

I want to set DNS redirect for site

  • December 7, 2022
  • 2 replies
  • 759 views

Hi Team I want to set the redirection on xyz.com, all the pages of xyz.com will redirect to abc.com.

please let me know what and where do I need to write code. in vhost file.

 

Thank You in advance.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by tushaar_srivastava

Hi @dear_at 

In order to set the redirection on xyz.com, you would need to configure a rule in the Apache web server. The rule should check for any request made to xyz.com and redirect it to abc.com.

You can achieve this by adding the following rule in your Apache configuration file:

<VirtualHost *:80> 
   ServerName xyz.com 
   Redirect 302 / http://abc.com/ 
</VirtualHost>

Also,

You can do this by creating a dispatcher rule in your dispatcher configuration.

You can use a redirect rule such as this one:

RedirectRule ^/ http://abc.com [R=301,L]

 This rule will redirect all requests to xyz.com to abc.com.

2 replies

Avinash_Gupta_
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
December 7, 2022

Hi @dear_at 

 

Try with this rule to redirect the old pages to new domain.

 

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
</IfModule>

  https://wpscholar.com/blog/redirect-old-domain-to-new-domain-via-htaccess/ 

tushaar_srivastava
tushaar_srivastavaAccepted solution
Level 6
December 11, 2022

Hi @dear_at 

In order to set the redirection on xyz.com, you would need to configure a rule in the Apache web server. The rule should check for any request made to xyz.com and redirect it to abc.com.

You can achieve this by adding the following rule in your Apache configuration file:

<VirtualHost *:80> 
   ServerName xyz.com 
   Redirect 302 / http://abc.com/ 
</VirtualHost>

Also,

You can do this by creating a dispatcher rule in your dispatcher configuration.

You can use a redirect rule such as this one:

RedirectRule ^/ http://abc.com [R=301,L]

 This rule will redirect all requests to xyz.com to abc.com.