Web Server Domain Question

mike-h30 wrote on Tuesday, May 26, 2009:

What needs to be changed in the code to allow one to point a domain at the openemr root folder?

For example, if I point "demo.mydomain.com" to the openemr directory, the site does not display when I type "demo.mydomain.com" in the browser address bar.  In order to get OpenEMR to load I have to type "demo.mydomain.com/openemr".

When I point the same domain to other test sites on my web server, those websites will load without having to type the root directory in the address bar.

-Mike

I

aperezcrespo wrote on Wednesday, May 27, 2009:

Hi
  Try this

I used it for a while until I installed a cms.

ajonate wrote on Wednesday, May 27, 2009:

The contents of the /openemr directory can be uploaded directly into the root directory for demo.mydomain.com, updating the globals.php paths accordingly. That way the application already resides exactly where you want it.

If you prefer the redirection route, simply create a .htaccess file with a redirect statement, as follows.

http://www.javascriptkit.com/howto/htaccess7.shtml

Good luck!

mike-h30 wrote on Wednesday, May 27, 2009:

Thanks for the responses Alfonso and Ajonate.

Ajonate,

My web root on SUSE is /srv/www/htdocs.    I have openemr installed like this: /srv/www/htdocs/openemr.   This is how it is specified in globals.php.   I point my domain to /srv/www/htdocs/openemr.   Are you saying to take the contents out of directory /srv/www/htdocs/openemr and then place them in srv/www/htdocs ? 

Also, what is different about OpenEMR that it requires these adjustments for pointing a domain at it?

-Mike

ajonate wrote on Wednesday, May 27, 2009:

Sure, just put it in your htdocs directory. There’s nothing sacred abut the directory name “openemr”. It’s just the way it’s delivered.

Another thing you might consider is forcing the secure https protocol when visitors go into the openemr program directory. While the probability of browser hijacks that concern banks and credit card processors is low, patient data is private so it should still be protected with encryption. Again, the .htaccess file can do that for you, by using the following code:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} openemr
RewriteRule ^(.*)$ https://easyemrtoday.com/openemr/$1 [R,L]

Where your program subdirectory is /openemr. Edit the 3rd & 4th statements accordingly for different program directory names. Note that you’ll also need ssl enabled to use https. You might also consider buying a certificate from godaddy for $12.99/year so visitors’ browsers don’t return the nasty messages that they return for self-signed certificates.

mike-h30 wrote on Wednesday, May 27, 2009:

Thanks for the tips!

-Mike

drbowen wrote on Wednesday, May 27, 2009:

Mike have you tried just changing the

$web_root = "/openemr";

in globals.php

to the following:

$web_root = "/";

Sam Bowen, MD

whimmel wrote on Wednesday, May 27, 2009:

We use subdomains like this to separate client practices and various testing installs.  I always have to set two variables in globals.php to accomodate this:

$web_root = ""; // a null string
$webserver_root = "/path/to/your/openemr";

Make sure your DocumentRoot and Directory settings in your Apache vhost config point to that same directory. Reload Apache and you should be good.

I create user accounts on the server for each practice so all three of those paths would look like this:

/home/practice/public_html/openemr

mike-h30 wrote on Wednesday, May 27, 2009:

Dr. Bowen and Bill,

Thank you for your suggestions.   First I tried setting $web_root = "/";  in globals.php and the result was that the loading of openemr timed out.  Not sure if this syntax is distro specific (I am running the latest CVS on a test box which has SUSE Linux Enterprise Server 11.0).

Next I set $web_root = ""; This worked! 

This is cool. I was wondering why the default setup of openemr was not letting a subdomain point to it but it seems it was a matter of a global variable setting.  Thanks a again!!

-Mike