0

I have a website on

mydomain.eu

and i want to redirect

mydomain.com

and

mydomain.org

to mydomain.eu. I want the url in the address bar to change to mydomain.eu.

Are there multiple ways to do this? For Example:

  • apache virtualhost
  • htaccess
  • dns records/domain forwarding from registrar
  • programmatically
  • other

Can you give an example of each?

mike_x_
  • 1,900
  • 3
  • 35
  • 69

1 Answers1

2

The options you give are correct:

apache virtualhost

You can create a redirect here, when you do that you have to point the DNS records to the server where apache is running: an example can be found here: https://www.digitalocean.com/community/tutorials/how-to-create-temporary-and-permanent-redirects-with-apache-and-nginx

htaccess

Similar to the virtualhost solution except that he redirect is made in another file example: Redirect all request from old domain to new domain

dns records/domain forwarding from registrar

With a DNS record only you can't do a redirect it should always be used with a forwarding service or one of the other options given

programmatically

You can create a redirect in the code, you should point the DNS records to the server running the application and make your webserver listen to the domainnames. example in PHP: How to redirect to another page using PHP

Cheers!

Niek
  • 346
  • 1
  • 9