Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Smith.93 on January 31, 2014, 10:11:02 PM

Title: Problem with SSI in links
Post by: Smith.93 on January 31, 2014, 10:11:02 PM
Hey guys, my English is very poor, forgive me if I express myself badly

I have a problem with SSI.php when I click on the links. For starters I have to clarify something, I am using xampp and the directory is as follows

localhost / xampp / htdocs / web   <---- my website
localhost / xampp / htdocs / forum <--- my forum

In the index of my website I put the following tag before the <html>:


require("../forum/SSI.php");


And then I called the function ssi_recentTopics():


<blockquote class="home">
<?php ssi_recentTopics(); ?>
</blockquote>


The result is this:
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.subeimagenes.com%2Fimg%2Fsin-titulo-1-833628.jpg&hash=9320b6d7ab5a83cd9bd8eef9c8fd457e1ea9cd3e)

You see properly but the link is wrong. the link to the topic "CACAC" is this:

http://127.0.0.1/[color=red]web[/color]/index.php?topic=2.msg2;topicseen#new

But this should be:

http://127.0.0.1/[color=red]forum[/color]/index.php?topic=2.msg2;topicseen#new

How I can fix this?
Title: Re: Problem with SSI in links
Post by: Arantor on January 31, 2014, 11:34:09 PM
That would imply that SMF is misconfigured. What does Settings.php say for $boardurl? (DO NOT INCLUDE THE ENTIRE FILE. JUST THAT ONE LINE.)
Title: Re: Problem with SSI in links
Post by: Smith.93 on February 01, 2014, 01:08:07 AM
 Hello Sir Cumber-Patcher Hello, thank you very much for responding.

In the settings.php file the "boardurl" line is this:


$boardurl = 'http://127.0.0.1/forum'; # URL to your forum's folder. (without the trailing /!)


Try removing the / but still does not work
I don't understand when you said this:

Quote
(DO NOT INCLUDE THE ENTIRE FILE. JUST THAT ONE LINE.)

that only include a line?
Title: Re: Problem with SSI in links
Post by: Arantor on February 01, 2014, 04:31:47 AM
No, I just meant for you to tell me that one line instead of posting the whole file because it contains passwords and so on.

That's also really strange, because SSI should use $boardurl as the base for making links...
Title: Re: Problem with SSI in links
Post by: Kindred on February 01, 2014, 08:50:52 AM
unless he has some sort of re-write?
Title: Re: Problem with SSI in links
Post by: Smith.93 on February 01, 2014, 01:29:08 PM
I would never change anything to the file, as this is the default.
To see if it works, I edited the file like this:


$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => '127.0.0.1/forum/index.php?board=' . $row['id_board'] . '.0',
'link' => '<a href="127.0.0.1/forum/index.php?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => '127.0.0.1/forum/index.php?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="127.0.0.1/forum/index.php?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>',
// Retained for compatibility - is technically incorrect!
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" />',
);


And the link looks like:

http://127.0.0.1/web/127.0.0.1/forum/index.php??board=1.0


No way to delete the first http://127.0.0.1/web/?
Title: Re: Problem with SSI in links
Post by: Kindred on February 01, 2014, 06:02:01 PM
oh. I see the possible problem

The apache handler assumes that anything NOT prefixed with http:// is a RELATIVE path... and so, it inserts the current url/path in front.
Title: Re: Problem with SSI in links
Post by: Smith.93 on February 01, 2014, 06:23:36 PM
Quote from: Kindred on February 01, 2014, 06:02:01 PM
oh. I see the possible problem

The apache handler assumes that anything NOT prefixed with http:// is a RELATIVE path... and so, it inserts the current url/path in front.

You're a genius!!
Thank you very much, really!
Title: Re: Problem with SSI in links
Post by: Arantor on February 01, 2014, 06:54:52 PM
That's not the Apache handler, that's how every single URL is built anywhere... if it doesn't say http or https at the start, it's explicitly assumed to be relative to the current page.
Title: Re: Problem with SSI in links
Post by: Kindred on February 01, 2014, 07:16:48 PM
Yes... But I thought that it was the server side handler that made that assumption.

Regardless of the actual thing making the assumption, it would seem to be the issue.