Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Friendly URLs, getting them activated.. ?

edited April 2007 in Vanilla 1.0 Help
Ok this might be really basic, but i've tried searching and tried looking around.. The .htaccess file is there by default, and SEF URLs DO work.. eg if I manually type in /discussion/1/ then it DOES load discussion ID 1.. but how do I make it so all the links are correct? Eg right now all my links in Vanilla still use the normal URLs not the friendly URLs.. ? There's nothing in the settings.. and as per the addon I tried adding the following line to my settings file: $Configuration['URL_BUILDING_METHOD'] = 'mod_rewrite'; ..but it didn't change anything. What am I missing here?! :(

Comments

  • That should do just fine...which settings file did you add it to?
  • edited January 2007
    <vanillapath>/conf/settings.php Added it after all the other lines.. Saved, uploaded, refresh site.. no change to the links. Am I meant to do something to make the setting active? Or adding that line does it?
  • after *all* the other lines, or just at the end before the closing php tag ?> ? That aught to do the trick...
  • Before the closing PHP tags. Directly following the final config line.
  • Noone has any ideas? I have Vanilla 1.0.3 out of the box, no modifications or hacks, just a few standard extensions. I add the line to the config file, nothing happens. Considering this is a standard install, surely it should just WORK. What could possibly stop it? Server settings? Do I need to make changes to the .htaccess?
  • What do you mean by "The .htaccess file is there by default" ? Default as in you already had one or as in you are using the default one that came with the Friendly URL zip?
  • I think he means that you don't need to download the Friendly URLs file, because all the rules (and I think they're even improved) are already present when you install Vanilla.
  • Yeh, what bjrn said. When I installed vanilla there was already an .htaccess file with rules inside it that seem perfectly fine. The problem is getting my Vanilla install to actually USE those rules.
  • Have you used mod_rewrite with any of your other scripts? Have you verified that it is actually working on your server?
  • .htaccess is in the default vanilla down load right? Since this is the case, can't we just get rid of it from the Friendly URLS "extension" please?
  • @jeremy2: I have other domains hosted on the same server, that use mod_rewrite, could this effect it? Seperate domains in seperate directories on the server. It works fine on the other domain though. Eg my main domain goes to /public_html/, that uses mod_rewrite perfectly. This one is a seperate domain going to /public_html/dirname, and it won't work.
  • I have same problem... This is strange... Default url is for example: [...]forum/comments.php?DiscussionID=197&page=1#Item_0 , but, if i for example change it manualy for /197/thread_name/ then i have everything ok...
  • edited April 2007
    This is still not working for me. Mod_rewrite is not the issue, I have plenty of other scripts now using similar friendlyURL methods perfectly. It's ONLY my vanilla install that refuses to do it. Also it's not mod_rewrite that is playing up, as mentioned previously if I manually type in a friendly URL it works perfectly, but the links inside my forum are not friendly URL links.. they're standard links. How does vanilla actually change all the links inside itself to friendly ones? Because that's the bit it's not doing.
  • edited April 2007
    Vanilla looks for a setting in your conf/settings.php file to use mod_rewrite. Paste this at the end of that file and you should be good to go:
    $Configuration['URL_BUILDING_METHOD'] = 'mod_rewrite'; // Standard or mod_rewrite
    edit: DOH!... I need to re-read the thread.

    The urls are built in the framework/Framework.Functions.php file, if you insert some strategic comments in the getUrl function you can effectively bypass the configuration setting:
    function GetUrl(&$Configuration, $PageName, $Divider = '', $Key = '', $Value = '', $PageNumber='', $Querystring='', $Suffix = '') {
    // if ($Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite') {
    if ($PageName == './') $PageName = 'index.php';
    return $Configuration['BASE_URL']
    .($PageName == 'index.php' && $Value != '' ? '' : $Configuration['REWRITE_'.$PageName])
    .(strlen($Value) != 0 ? $Divider : '')
    .(strlen($Value) != 0 ? $Value.'/' : '')
    .(($PageNumber != '' && $PageNumber != '0' && $PageNumber != '1') ? $PageNumber.'/' : '')
    .($Suffix != '' ? $Suffix : '')
    .($Querystring != '' && substr($Querystring, 0, 1) != '#' ? '?' : '')
    .($Querystring != '' ? $Querystring : '');
    /* } else {
    if ($PageName == './' || $PageName == 'index.php') $PageName = '';
    $sReturn = ($Value != '' && $Value != '0' ? $Key.'='.$Value : '');
    if ($PageNumber != '') {
    if ($sReturn != '') $sReturn .= '&';
    $sReturn .= 'page='.$PageNumber;
    }
    if ($Querystring != '' && substr($Querystring, 0, 1) != '#') {
    if ($sReturn != '') $sReturn .= '&';
    $sReturn .= $Querystring;
    }
    if ($sReturn != '') $sReturn = '?'.$sReturn;
    if ($Querystring != '' && substr($Querystring, 0, 1) == '#') $sReturn .= $Querystring;
    return $Configuration['BASE_URL'].$PageName.$sReturn;
    } */

    }
This discussion has been closed.