Fork me on GitHub
Current release is 2.1.6 (21 Nov 2014).

Users who have not yet upgraded to 2.1 should get security release 2.0.18.14 (1 Nov 2014). We will stop providing these security releases to 2.0 at the end of this year.

SEO trick (for developers)

SS ✭✭
edited March 2011 in Vanilla 2.0 Help
For example, news. Just example, no explanations

Example:

// class.newsconttroller.php // file

// public function Index($Code) {
if (is_numeric($Code)) {
$this->View($Code);
}
// elseif(... other check for news category url code, etc.
}

...
// public function View() { // method
...
// trick
$NewsModel = Gdn_NewsModel();
$Story = $NewsModel->GetID($NewsID);
...
$NewsStoryURL = 'news/'.$Story->NewsID.'/'.Gdn_Format::Url($News->Title); // or you can use Clean() method
$CanonicalUrl = $this->CanonicalUrl(Url($NewsStoryURL, True));
if ($NewsStoryURL != $this->SelfUrl) Redirect($CanonicalUrl, 301);
...

Comments

Sign In or Register to comment.