Change site via . htaccess

Asked

Viewed 72 times

0

I have the following urls:

www.meusite.com.br/pagina1
www.meusite.com.br/pagina1/a/b/c
www.meusite.com.br/pagina1/1/2/nome-perfil

I need that when accessing my site, I have a redirection in htaccess to another site, with the same basis, becoming:

www.meunovosite.com.br/pagina1
www.meunovosite.com.br/pagina1/a/b/c
www.meunovosite.com.br/pagina1/1/2/nome-perfil

How can I do that? I already have the following setup on it:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

And in index.php I have:

header("Location: http://www.meunovosite.com.br");

However, if I search my site on Google, it will put the folders that belong to it, and in this case it will be redirected only to the home of the site.

  • Can’t you set up your application server to give a 301 to the new site? I think it’s the easiest.

  • The problem is the subfolders that are indexed by google...

  • You can use 301 redirect. With this all the rank is passed to new link

  • Can you post an example? Obg.

  • One-night stand here that he speaks of Nginx, which is what I’ve done, I do 301 from com.br to . com, he’s 301 on any link with sub folder or not. (I’m no expert on this, but I think it would suit a simple scenario)

1 answer

1

It would look like this using 301 redirect via htaccess:

redirect 301 /pagina1 http://meunovosite.com.br/pagina1
redirect 301 /pagina1/a/b/c http://meusite.com.br/pagina1/a/b/c
redirect 301 /pagina1/1/2/nome-perfil http://meunovosite.com.br/pagina1/1/2/nome-perfil

Helping

  • But in this case, I use a system routing the links, so it’s kind of impossible for me to adjust all the relevant links to the site.. :(

  • I was thinking that the Urls were specific (only the 3 you posted).

Browser other questions tagged

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