Skip to main content

How to redirect 1 domain name to another and correct URL bar

If like me, you want to redirect your old domain name to your new one while correcting the visitors’ URL bar, the solution is quite simple in fact using your VirtualHost.

Here is my example, I wanted to redirect and (Without www) to directly and make sure the domain name change in the visitors’ URL bar, you need to tweak a bit your Vhost located in your


to add the domain name you want to redirect at the beginning of your existing VirtualHost.

Here is the interesting part of mine:



First, the server will answer any request on the port 80, the default HTTP port (*:80) for the ServerName or the Alias and will redirect any folder called (/) to the website

Like that, if you call, it will redirect to Or if you call, it will redirect to

Easy right?