.htaccess URL redirection

Asked

Viewed 78 times

0

Hello,

I was wondering if there’s any way I could set it up. htaccess for when a person accesses the site by the domain meusite.com it redirects to the folder /site2/ and whoever accesses by the domain meusite2.com it redirects to /site1/, It’s Why I’m using a VPS and I don’t want to touch its settings.

1 answer

0


You can do it like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?meusite.com$
RewriteRule . site2 [R=301,L]

RewriteCond %{HTTP_HOST} ^(www.)?meusite2.com$
RewriteRule . site1 [R=301,L]

Who accesses through the domain (www.)meusite.com will be redirected to meusite.com/site2 and who access by (www.)meusite2.com will be redirected to meusite2.com/site1.

Browser other questions tagged

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