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.

2 Answers 2


I ended up creating a multisite structure.

  1. Under sites folder I created a folder for each subdomain like: "aaa", "bbb",...
  2. 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)

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

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

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



xxx.example.com IS a subdomain. It could be set as example.com/xxx/, or xxx.example.com, doesn't really matter. The point is, you are trying to achieve a subdomain structure. And you should be able to set subdomains.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.