How would I move the first folder in a url to be at the beginning of a url with htaccess.
From this: www.example.com/folder/index.php To this: folder.example.com
And also make so if I want to go to folder.example.com/orders, it doesn't do this folder.example.com/folder/orders
I'm not real familiar with writing htaccess rewrite rules, but was trying to put this together from stuff I read:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?!www\.)([^.]+)\.example\.com$ [NC]
RewriteCond %{REQUEST_URI}::%1 !^/([^/]+).*?::\1
RewriteRule ^(.*)$ /%1/$1 [L]
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^%{REQUEST_URI}::%1 !^/([^/]+).*?::\1 [L,NC,R]
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.*)index\.php($|\ |\?)
RewriteRule ^ /%1 [R=301,L]
I'm looking to use it for a web application to direct each user to their own folder. Any help or thoughts if this would be a good practice would be greatly appreciated.