How do I redirect a domain to a subdomain?

Asked

Viewed 177 times

0

I have a site that generates sites in real time, each site created is generated a subdomain to access it, example the functioning of wordpress with., staying that way: http://nomedousuario.meudominio.com.br.

How do I, after hiring a new domain, redirect it to the subdomain I created in the website generator?

Example:

I created a website and generated the following address: http://nomedousuario.dominio.com.br, after doing so, I went to register.br and registered a new domain called novodominio.com.br and I need a redirect to the address when accessing it http://nomedousuario.dominio.com.br but preserving in the address bar novodominio.com.br. Do not confuse with 301 redirect.

  • 1

    Did you ever see if a CNAME won’t solve your problem? Just not sure if the URL will be changed.

  • How would I do this via CNAME? I could only do it with subdomain and not with other domains.

  • 1

    Did you register the novodominio.com.br using an ADDRESS type record right? I believe registering it as a CNAME for nomedousuario.dominio.com.br will work. I’m just not sure about the URL change issue (I don’t think it will change), but I can’t test it at the moment.

  • Good Morning. You managed to create this redirect in the.br record. Am I having the same problem? Thank you.

1 answer

3


You can add these lines in the know file .htaccess:

RewriteCond %{HTTP_HOST} ^novodominio.com.br
RewriteRule ^(.*) http://nomedousuario.dominio.com.br/$1 [P]

With this code, you will access the content of http://nomedousuario.dominio.com.br, but the address displayed in the bar will be novodominio.com.br.

Other examples you will find in LINK

Browser other questions tagged

You are not signed in. Login or sign up in order to post.