Redirect access to a subdomain

Asked

Viewed 24 times

0

I have the following subdomain: http://projectos.sitecom.br. How I would make the user when typing: www.site.com.br/projects, was redirected to the given subdomain? I created inside the directory projects the following rule in .htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} www.site.com.br/projetos
RewriteRule ^(.*)$ http://projetos.site.com.br/$1 [L] 

But it didn’t work! In Cpanel I can redirect the subdomain to another directory, but not the other way around. I don’t know much htaccess. I tried that way too:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.com.br/projetos$
RewriteRule (.*) http://projetos.site.com.br/$1 [R=301,L]

and

RewriteEngine on
RewriteCond %{HTTP_HOST} ^site.com.br/projetos$ [OR]
RewriteCond %{HTTP_HOST} ^www.site.com.br/projetos$
RewriteRule ^/?$ http://projetos.site.com.br/ [R=301,L]

But they didn’t work either! I put htaccess in the root folder and nothing!

1 answer

0

Hello, I apologize for not having worked

RewriteEngine On

RewriteCond %{HTTP_HOST} ^antigoendereco.com$ [OR]

RewriteCond %{HTTP_HOST} ^www.antigoendereco.com$

RewriteRule (.*)$ http://www.novoendereco.com/$1 [R=301,L]

(Note: Only on Linux servers. If you use Wordpress.com or Blogger, you cannot redirect in this way.)

Test to see if it solves your problem and comment again I hope I helped.

Browser other questions tagged

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