HTACCESS - Subdomain

Asked

Viewed 2,080 times

2

Does anyone there know how to set up htaccess? I need it to work with the subdomain, and not to show the main domain in the address bar when the subdomain is open. Ex of how you are now:

[https://www.site.com.br/www.subdominio.com.br]

My current htaccess is the code below:

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.site\.com\.br$ [NC]
RewriteRule ^(.*)$ https://www.site.com.br/$1 [L,R=301]

1 answer

3


You’re gonna need to put this on .htaccess of the subdomain folder:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdominio.site.com.br$ [OR]
RewriteCond %{HTTP_HOST} ^www.subdominio.site.com.br$
RewriteRule ^(.*)$ http://www.site.com.br/subdominio/$1 [P]

In the example I am considering that you have the folder subdominio at the root of the domain, you can edit according to the need.

  • Brother, thank you. Your help has been very helpful. Hugs!

Browser other questions tagged

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