I will start by saying I no very little about htaccess. I would like a way for a subdomain like example.my-domain.com to use the files located in /example folder in home directory. No matter what I try like sam.my-domain.com it shows a 404 error and does not load the index file in the "sam" directory.
Steps I have done so far:
I created an A record in my DNS file *.my-domain.com
I created an "example" folder and "sam" folder in my home directory.
I made the edits to my htaccess file based on previous answers
This is my htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(.*)\.my-domain\.com
RewriteRule ^(.*)$ http://my-domain.com/%1/$1 [L,NC,QSA]
</IfModule>
How do I get any subdomain to automatically load the corresponding folder from the home directory?
Information gathered from: