For SEO purposes, it is recommended to have all non-filename URLS (directories or prettified "permalink" URLs to borrow a Wordpress phrase) end with an ending slash.
It's also suggested that the / helps with performance due to the way Apache works.
On Yii, using the CUrlManager pattern rewrites, i'm able to make my application links have a trailing slash by adding in "urlSuffix"="/" in the urlManager configuration. However this doesn't solve the issue as if i hit, for example,
I did this quick fix that works for me. Put into your applications components folder and make sure to extend your controllers from this class (eg "NewsController extends BaseController"):
<?php
class BaseController extends CController
{
public function init()
{
parent::init();
// Force traling slash to request URI
$requestUri = yii::app()->request->requestUri;
if (false === strpos($requestUri, '?') && '/' !== substr($requestUri, strlen($requestUri) - 1, 1))
{
yii::app()->request->redirect("{$requestUri}/", true, 301);
}
elseif ('/' !== substr($requestUri, strpos($requestUri, '?') - 1, 1))
{
yii::app()->request->redirect(substr($requestUri, 0, strpos($requestUri, '?')) . '/' . substr($requestUri, strpos($requestUri, '?')), true, 301);
}
}
}
?>