Reputation: 1593
I have created one sub-domain. It is also accessed via folder. For example,
subdomain.website.com
which is also accessed in the following url
website.com/subdomain
How do i stop this? I think it can be done with htaccess. I am not sure.
Upvotes: 2
Views: 260
Reputation: 12375
add following line in the .htaccess
in your root directory:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^subdomain\.domain\.com$ [NC]
RewriteRule ^/(.*)$ http://subdomain.domain.com/$1 [L,R=301]
Upvotes: 0
Reputation: 143846
In the htaccess file in website.com
's document root, add these rules:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^subdomain.website.com$ [NC]
RewriteRule ^subdomain/?(.*)$ http://subdomain.website.com/$1 [L,R=301]
Upvotes: 1