By salmangreat
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: mywebsite.co.uk/folder1 and folder1.mywebsite.co.uk should be the same directory, mywebsite.co.uk/folder2 and folder2.mywebsite.co.uk 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 mywebsite.co.uk and put a .htaccess file in the root folder, which looks like the following;
RewriteEngine on RewriteCond %{HTTP_HOST} ^(.).mywebsite.co.uk RewriteRule ^(.)$ http://mywebsite.co.uk/%1/$1 [L,NC,QSA]
At the moment any subdomain I try, it goes to the main root directory. for example: folder1.mywesbite.co.uk, folder2.mywebsite.co.uk, blahblah.mywebsite.co.uk 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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.