How to redirect .com domain with .htaccess

0

I have 2 domains, example.com and example.com pointing to the same wordpress site.

I would like to redirect every time someone goes to example.com, is redirected to example.com/en

I found this code, but it also redirects example.com.br to / in

RewriteEngine on
RewriteCond %{HTTP_HOST} !^example\.com$
RewriteRule ^ http://www.example.com.br/en [L,R=301]

Can anyone help me?

P.S: Preferably works with both www, and without.

    
asked by anonymous 07.10.2015 / 17:02

1 answer

1

This should help.

RewriteEngine on
RewriteRule ^(.*)$ http://www.example.com.br/en [R=301,L]

Or try this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$
RewriteRule (.*)$ http://www.example.com.br/en [R=301,L]
</IfModule>
    
07.10.2015 / 19:06