SEO URL Rewriting for GARS

by Mark Marucot on August 19, 2007

I discussed the steps to setup the URL rewriting for VBulletin. For those forums using GARS, here are the steps.

  1. Edit geek/gars/mods/display/top.php

    Search:

    CODE:
    1. $bits .= "<tr><td align=\"$stylevar[left]\"><span class=\"smallfont\"><a href=\"showthread.php?t=$value[threadid]\" title=\"$value[title]\">$value[title]</a></span></td></tr>";

    Replaced with

    CODE:
    1. $thread['url'] = strtolower(str_replace(" ", "-", $value[title]));
    2. $thread['url'] = strtolower(str_replace("'", "", $value[title]));
    3. $thread['url'] = ereg_replace("[/?!.$%£()~*@#]+", "", $thread['url']);
    4. $bits .= "<tr><td align=\"$stylevar[left]\"><span class=\"smallfont\"><a href=\"t$value[threadid]-" .  $thread['url']  . ".html\" title=\"$value[title]\">$value[title]</a></span></td></tr>";

  2. Edit geek/gars/mods/display/toc.php
    CODE:
    1. $bits.="<li><div class=\"smallfont\"><a href=\"showthread.php?t=$threadinfo[threadid]&amp;garpg=" . ($toc_x + 1). "#content_start\">";
    2. $bits.=$this->navigation['pages'][$toc_x]['text'] ? $this->navigation['pages'][$toc_x]['text'] : construct_phrase($vbphrase['GARS_pagex'],($toc_x + 1));
    3. $bits.="</a></div></li>";

    Replaced with

    CODE:
    1. $thread['url'] = strtolower(str_replace(" ", "-", $this->navigation['pages'][$toc_x]['text'] ? $this->navigation['pages'][$toc_x]['text'] : construct_phrase($vbphrase['GARS_pagex'],($toc_x + 1))));
    2. $thread['url'] = ereg_replace("[/?!.$%£()~*@#]+", "", $thread['url']);
    3. $bits.="<li><div class=\"smallfont\"><a href=\"a$threadinfo[threadid]-" . ($toc_x + 1). "-$thread[url].html\">";

  3. Edit the following templates

    GARS_forumbit_level1_nopost
    GARS_forumbit_level1_post
    GARS_forumdisplay
    GARS_simple_threadbit
    GARS_subforumbit_nopost
    GARS_subforumbit_post
    GARS_threadbit

    Replace:

    CODE:
    1. showthread.php?$session[sessionurl]t=$thread[threadid]

    with

    CODE:
    1. t$thread[threadid]-$thread[url].html

Random Posts

Leave a Comment

Previous post:

Next post: