Redirecting

gutiersa wrote on Saturday, December 24, 2011:

Hi.

I really like the sites feature in openemr. One of my sites is named openemr.

However my staff and other doctor are having a very hard time adjusting. I have already set up all the links in the office computers, but when my partner wants to access from outside the office, he needs me to send him the link everytime. Otherwise he cannot access it.

I have tried several ways to work around this so the address remains unchanged, but no luck. This is what I have done in httpd.conf:

Redirect /openemr http://127.0.0.1/openemr/?site=openemr
Redirect /openemr /openemr/?site=openemr
Redirect /openemr https://localhost/openemr/sites/openemr
Alias /openemr C:\xampp\htdocs\openemr\sites\openemr   

With alias directive I actually placed a modified index.php file in the /sites/openemr folder where I specifically set:

$site_id = ‘openemr’;

None of these have worked. All attemps are of course in a test server. I have used the alias directive succesfully in the past under other circumstances, but this time I am lost.

My goal is for my staff to use a simple address such as:

example.net/sitename

any ideas?

ty sandra

juggernautsei wrote on Monday, December 26, 2011:

Sandra,

Here are a couple of questions to answer.

Does your office turn off the modem equipment every night before leaving the office?

       If they do, this can cause your system to get a new IP address everyday and why you have to send the link out everyday.

Have you thought about getting a static IP address for your outside connection?

      This cost a little more but is worth avoiding the agrevation you mentioned.

There are some free services available like http://www.no-ip.com/ that will help you manage DNS without adding to your cost.  

The redirections are great but over kill for just a simple outside connection.

If you have any more questions, don’t hesistate to ask. 

Sherwin
www.openmedpractice.com

yehster wrote on Monday, December 26, 2011:

Sandra,
Rather than mucking with httpd.conf one approach would be to create another webpage in the root of your webserver that uses the header function.

If you make a new index.php page with content similar to this:

<?php
header("location:http://www.sandrasite.net/openemr/?site=openemr");
exit;
?>

Then accessing that new php file will get you to the specific openemr site.
That should address your problem of getting a simpler address for the sitename issue.

http://ditio.net/2008/10/04/php-redirect-header-location/

Whether or not you need additional work to keep a dynamic IP address up to date too, I’m not sure.
-Kevin Yeh
kevin.y@integralemr.com

gutiersa wrote on Tuesday, December 27, 2011:

Hi.

thanks so much for your replies.

Sherwin:
Yes I do have a static IP address, and all equipment including server is on 24/7.
I have domains with godaddy and just recently redirected my ip address to our domains.
hence now our link looks like this

sandra.net/myopenemr/?site=mysite

as opposed to:

xx.xxx.xxx.xx/myopenemr/?site=mysite

Kevin:
I have my main practice. site name is openemr
I also do suboxone treatment which requires me to keep a separate set of charts. that site name is subtx, finally I have another primary care office at a different location, with a different TIN. that site name is otherpractice.

If a place a header file in the base openemr directory, how do I access the different sites?

I would like my links to look like this:

sandra.net/openemr
sandra.net/subtx
sandra.net/otherpractice

and for each to direct to the appropriate site. Of course, if there is a way to do it that is not too complicated.

thanks for the help

Sandra

yehster wrote on Tuesday, December 27, 2011:

Sandra,
To make
sandra.net/openemr
go to your “main site”.  Edit the index.php that is installed with openemr.
change the line in the if/else block for the default when no get value for site_id is specified to be “openemr” instead of “default”
Then to make
sanrda.net/subtx work,
create a directory in your web root called subtx and create a new index.php  file for that directory like I mentioned before which sets the site id.

gutiersa wrote on Tuesday, December 27, 2011:

Ok thanks. Going to try it. I’ ll post back

gutiersa wrote on Wednesday, December 28, 2011:

I followed the instructions, but it stops at:

redirecting

how can I get this line:

<?php echo “interface/login/login_frame.php?site=$site_id” ?>

to echo “openemr/interface/login/login_frame.php?site=$site_id”

I tried “…/openemr/interface/login/login_frame.php?site=$site_id”

but does not work either

sandra

yehster wrote on Wednesday, December 28, 2011:

Sandra,
Not sure where you are using echo. You shouldn’t be using echo for anything.
Are you using the php header function anywhere?

yehster wrote on Wednesday, December 28, 2011:

Also, if you were echoing anything before the header function, that breaks things.  You aren’t allowed to output anything before a server side redirect.

If you are having problems getting the syntax right for a redirect with headers, you might try a javascript approach.
Create a file like this.  NOTHING else… No php tags.
Put that anywhere, and the browser should go to the other site.

<script>
    window.onload=window.document.location="http://sandra.net/openemr/?site=subtx";
</script>

gutiersa wrote on Thursday, December 29, 2011:

Yes beautiful!

Thank you so much.

Sandra