Read about OpenEMR's Response to the COVID-19 Pandemic at

Re-writing and re-mapping multisite install

I would like to set up an openemr multisite instance which can be accessed as:

where sitename would be re-written to:


Is this possible? Is there a PHP variable that holds the site ID which can be sent to the server? Apache or nginx


sure @gutiersa,


Please elaborate more, do both nginx and apache see this? I apologize in advance, I am a clinician, not a programmer.
Looks like this is an array?
I keep getting this error: session id missing. Or something like it.
Is it possible to just make the code send the user back to the login screen?
Thanks Sandra

sure, after you set up another site by the guide, you’ll access it with the GET parameter

so for mynewsite instead of default

then the session will remember this after login and operate out of the correct database that you created with the multisite setup

1 Like

This is interesting!
My first guess would be to do a rewrite or return.
The important thing is to include the site=mysite query parameter.
$_SESSION[‘site_id’] is a session variable and gets store into a cookie by login via globals include.


I am sorry, this was a loaded question.
What I meant, by the second part of it should probably go on a different thread.
I will start a new thread.

And I will clarify the mapping question. Say I was crazy enough to want to manage EHR for other doctors, and I wanted to map their sites at the level of the server, whether nginx or apache. What I would like to do is for example

$site --> /interface/login/login.php?site=$site

Can this be done?


no need. Exactly what are you looking to do? Looks like a redirect from a subdomain!

1 Like

Yes, the problem is this chat does not allow one word replies
I re-wrote it above and gave you a like

1 Like

I’m going to let the joke that begs to be said, go by!:slight_smile:

Not crazy but usually multi is facility based. Still, it runs in it’s own database. The only thing shared is source code. Site id has two main purposes, database and document directory selection.

In the end you should be able to add a rewrite using a regx to catch end of uri then rewrite to a query string.
I’m not nginx literate so you’re on your own there.