I have different sites in MAMP, each of them being located in ../htdocs/
i.e. ../htdocs/site1, ../htdocs/site2, ../htdocs/site3, etc.
In some page of site1, I have something like

    <li>Petit retour aux sources : comment tout a commencé</li>
    <li>Le golfe du Morbihan en 2008</li>
    <li>En 2009, cap sur l'archipel de Glénan</li>
    <li>Cette année (2010), c'est Bénodet !</li>
    <li>Et pourquoi pas <a href="/site1/node/2">Stockholm</a> en 2011 ?</li>
    <li>2012, <a href="/site1/node/36">l'année des cairns</a> du golfe du Morbihan</li>
    <li>En 2013, tranquillement sur la Vilaine...</li>
    <li>Golfe du Morbihan « agayne » en 2014</li>
    <li>2015 : encore le <a href="/site1/node/50">Golfe</a> mais en famille</li>

Then, I move site1 to web provider and ../htdocs/site1 becomes www (root of the web site).
And, of course, URLs such as "/site1/node/36" don't work anymore :-(
How can I solve that?


It sounds like in MAMP you're using one domain, localhost, instead of three separate domains for three separate codebases.

You should set up three domains in MAMP and then you can use relative urls such as "/node/50" instead of "/site1/node/50".

Then your config would be in /sites/default/settings.php, with an included settings.local.php that is git excluded to use different database credentials between the local and production sites.

Multisite is a different set up.

You wouldn't have three separate codebases, such as "/htdocs/site1", "htdocs/site2" and "htdocs/site3".

You would have one codebase such as "htdocs/mymultisite".

With a non-multisite set up with three separate codebases, you would create three hosts in MAMP and then point each docroot to that site's docroot, for example, "/htdocs/site1", "htdocs/site2" and "htdocs/site3".

For a multisite set up, you would use one codebase (such as "htdocs/mymultisite" and create a sites folder for each domain. First, you would copy example.sites.php to sites.php in the /sites folder of your repo. Then for each host, you would set up a folder with a separate settings.php, for example:


with the folder name corresponding to the domain set up in MAMP.

(With a non-multisite set up with separate codebases, you can just use the /sites/default/settings.php)

For both separate codebases and hosts in mamp, and for multisite with sites folders, it should work to visit each domain, such as site1.local in your browser, the urls will be relative to that URL.

If you are using multisite, when you want to go to production, you can set up a folder for production. Set up a folder for production:


There is a lot of information about setting up multisite Drupal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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