Redirect with htaccess without changing URL

Asked

Viewed 2,002 times

1

I have a system that runs on the address www.dominio1.com.br/sistema and need the user to type www.dominio2.com.br/sistema is directed to www.dominio1.com.br without changing the URL.

I did a test by putting one .htaccess at the root of dominio2, which follows below:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^dominio2\.com\.br$ [OR]
RewriteCond %{HTTP_HOST} ^www\.dominio2\.com\.br$
RewriteRule ^/?sistema/(.*) "http\:\/\/www\.dominio1\.com\.br\/sistema\/$1" [P]

The system directs correctly, but changes the URL to dominio1.

The fact that I have specified the system folder is because the domains are from different companies, hosted on the same server and share the same system. So to advertise, each wants to use their domain in the URL.

From now on, thank you.

  • 1

    Good night! , I had the same doubt and found the answer here : https://forum.imasters.com.br/topic/469785-redirecionar-com-htaccess-sem-perder-a-url/ I hope it helps!

No answers

Browser other questions tagged

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