like this one below:
ServerName mydomain.com
ServerAlias *.mydomain.com
Second, add this code to your .htacess file
# SUB DOMAINS
RewriteCond %{http_host} !www\.([a-z0-9-]+)\.([a-z0-9-]{2,5})$ [NC]
RewriteCond %{http_host} ^(www.)?([a-z0-9-]+)\.([a-z0-9-]+)\.([a-z0-9-]{2,5})$ [NC]
RewriteRule (.*) /clients/%2/$1 [L]
# /SUB DOMAINS
Finally, you should create a /clients/ folder in the main directory. Now every folder under /clients/ folder is a subdomain.
For ex. If you have a test/ folder under the /clients/ folder, you can call the folder test.mydomain.com
No comments:
Post a Comment