Custom subdomains with htaccess I have page structures like:


example.com/aaa
example.com/aaa/a1
example.com/aaa/a2
example.com/bbb
example.com/bbb/b1
example.com/bbb/b2
example/com/ccc
........


What I need is instead example.com/xxx/x1, I want users to see xxx.example.com/x1

How can I achieve this with a rewrite rule? Or any other suggestions?

Subdomains module does not work for me because it doesnt allow custom subdomains.
I ended up creating a multisite structure.


Under sites folder I created a folder for each subdomain like: "aaa", "bbb",...
I created a settings.php inside each folder (starting with php tags, do not close it though):



include_once(dirname(dirname(__FILE__)) . "/default/settings.php");
$conf['site_frontpage'] = "aaa";



(It inherits the general settings.php file since I dont need very different settings per domain)


Created a sites.php file inside sites folder (again starting with php tags):



  $sites['aaa.example.com'] = 'aaa';
  
  $sites['bbb.example.com'] = 'bbb';
  
  .......