How to have each folder within a root folder act as a subdomain?

March 24, 2013 1.6k views
Hello there, I am new to DigitalOcean and new to server management. What I am trying to achieve is that, I want each of my folder in the root folder, act as a subdomain. For e.g: and should be the same directory, and should be same. At my old host, I just use to create folders within the root directory and then they were accessible as subdomains. I am trying to achieve the same effect. Someone was helping me with this on the chat, but then we were waiting for my dns to get updated. So far he ased me to add * in CNAME and point it to and put a .htaccess file in the root folder, which looks like the following; RewriteEngine on RewriteCond %{HTTP_HOST} ^(.*)\.mywebsite\.co\.uk RewriteRule ^(.*)$$1 [L,NC,QSA] At the moment any subdomain I try, it goes to the main root directory. for example:,, all goes to the index.html file in /var/www. folder1 and folder2 exists in the root but blahblah doesn't exists. Can someone please help me. Regards Salman
1 Answer
What does your does the rest of you Apache config look like?
Have another answer? Share your knowledge.