Reputation: 39
I have a site with sub-domain concept, like
http://**test**.abc.com/
It works fine. But user try some different name instead of test like
http://**sdfd**.abc.com/
It will shows the file structure. How to solve this.. And how would I redirect the wrong url to my url.
Upvotes: 1
Views: 52
Reputation: 784898
You can use this code in your .htaccess
file of subdomain's DocumentRoot
:
RewriteEngine On
RewriteCond %{HTTP_HOST} !=test.abc.com [NC]
RewriteRule ^ http://test.abc.com%{REQUEST_URI} [NE,R=301,L]
Upvotes: 1