How to redirect one domain, If you want to redirect your old domain to another domain So you will have to use the rewrite module of Apache. By default, this module will be enabled in Apache 2.4 Version. We can redirect the domain URL to another domain in the Apache server on Linux.
Check Out: Troubleshooting Apache
How To Redirect One Domain To Another Domain In Apache:
I have created a file abc.html under the directory path /var/www/html/
echo "one domain to another" > /var/www/html/abc.html
Check Rewrite module enabled or defined or not in Apache 2.4 Version
grep rewrite /etc/httpd/conf.modules.d/00-base.conf
Now you have to configure Virtual Hosting If you don’t know how to Check out here.
I have an old domain abc.com and I have a file that was created by me.
Note: If you face in accessing the website from the outside the network, So you may stop firewall & make en entry in hosts file if you’re not using the DNS server for Domain Name resolves.
Check Out: Apache Server Status
You may see Virtual Hosting Settings here
Now I will redirect abc.com to pankaj.com using the Rewrite module in Apache 2.4 Version. As you can see now it’s redirecting to pankaj.com.
This is a simple redirection I will show you more with customizing in upcoming articles.
That’s it url redirect redirect apache