Temporary redirect

2

I have an application that needs to change domain

app.com.br

I need to switch to

app2.com.br

However while I do not change the dns I need a temporary redirect

for example

app.com.br/path/teste -> app2.com.br/path/teste  

I can do this by putting a header in index.php but if someone goes directly into a path without going through the index php it is not redirected.

How can I fix this?

    
asked by anonymous 11.08.2014 / 17:23

1 answer

1

The .htaccess must be at the root of your domain app.com.br :

RewriteEngine On
RewriteBase /
#Para todos os requestes para www.app.com.br
RewriteCond %{HTTP_HOST} ^www\.app\.com\.br$
#Redireciona para app2.com.br
RewriteRule (.*) http://www.app2.com.br/$1 [R=301,L]
    
11.08.2014 / 19:05