News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

different Hostnames, same database?

Started by -christian, July 21, 2007, 12:15:32 PM

Previous topic - Next topic

-christian

Hi everybody,

just having a little problem, that I would like to install a smf to a intranet-server. This particular machine is accessible from the net via the name server.com. From the LAN it has to be called with a different name e.g. lan.com.

As SMF is needing a hostname as the boardurl-variable I am stuck here. Recently played around with mod_rewrite but had no luck.

Any help appreciated.

Christian A. Herrnboeck

Hi Christian,



The easiest way to do that, would be to install two copies of SMF, with the same database info. Once for the public, and one for the intranet.


Regards,
Christian A. Herrnboeck


Farmers:Producing food for the world!

-christian

Quote from: ChristianH. on July 21, 2007, 03:18:06 PM
Hi Christian,



The easiest way to do that, would be to install two copies of SMF, with the same database info. Once for the public, and one for the intranet.

Mh, but there are several setting which are stored in the db, such as theme, attachments and smiley urls, which also include the hostname. So that will not work.

Any other hints!?

SleePy

you could use the public one and let your lan users just use it.

You could also modify SMF to use 2 different URLS but it requires some edits to work properly.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

-christian

Quote from: SleePy on August 02, 2007, 01:39:18 PM
you could use the public one and let your lan users just use it.

You could also modify SMF to use 2 different URLS but it requires some edits to work properly.
That is due to technical issues not possible. Would that be major edits or could I just implement someting like


if ($_SERVER['HTTP_HOST'] == 'intern')


this?? If this is true, just change the boardurl variable to a different value?

SleePy

yes you could do a if and check for $boardurl.
But then your themes urls would be different.

You could add this at the end of loadTheme in Subs.php, I use something similar as well. I made a $boardurl_default which has my default board url so I could run this check.


global $yourdomains, boardurl_default;
if(isset($yourdomains[$_SERVER['HTTP_HOST']]))
{
foreach($settings as $key => $value)
$settings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . '/community/', $value);

foreach($modSettings as $key => $value)
$modSettings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . '/community/', $value);

}
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

-christian

Quote from: SleePy on August 12, 2007, 10:42:07 PM
yes you could do a if and check for $boardurl.
But then your themes urls would be different.

You could add this at the end of loadTheme in Subs.php, I use something similar as well. I made a $boardurl_default which has my default board url so I could run this check.


global $yourdomains, boardurl_default;
if(isset($yourdomains[$_SERVER['HTTP_HOST']]))
{
foreach($settings as $key => $value)
$settings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . '/community/', $value);

foreach($modSettings as $key => $value)
$modSettings[$key] = str_replace($boardurl_default, 'http://' . $_SERVER['HTTP_HOST'] . '/community/', $value);

}

Nice thx. I am not quite sure were to put this. There is no function loadTheme in Subs.php, or am I wrong?

-christian

thx for your answer.

I found the function loadTheme. But it seems as if the arrays $modSettings and $settings do not cover everything:

the lines 16 and 17 of the generated html-code look like
<link rel="stylesheet" type="text/css" href="https://lan.com/smf/Themes/default/print.css?fin11"; media="print" />
<link rel="help" href="https://server.com/smf/index.php?action=help"; target="_blank" />


which means that the first link is parsed by your hack, but the second is not. Do you have an idea of how to parse the whole html-code? which function generates this?


-christian


SleePy

#9
That looks like a line from the index.template.php

Can you paste that line here? Just search for those parts in the file but it should be in the <head> section..

I am thinking it may be because it is a multi-dimension array. And my script doesn't fix this for those. We would need to add another function quickly so it can be done recursively.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

metallica48423

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

-christian

Quote from: metallica48423 on August 23, 2007, 02:12:39 AM
have you tried this out?
http://www.simplemachines.org/community/index.php?topic=171340.msg1093056#msg1093056
Geeeh, that sounds very good. Time to give it a try. Thanks for the link, I tried the search as well but had no luck. Will test it and report.

Advertisement: