PHP code example of comradepashka / yii2-seokit
1. Go to this page and download the library: Download comradepashka/yii2-seokit library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
comradepashka / yii2-seokit example snippets
public function behaviors()
{
return array_merge(parent::behaviors(), [
[
'class' => UrlHistoryBehavior::className(),
'url_attribute' => 'url' // default
]
]);
}
foreach ($model->UrlHistory as $item) {
echo %item->old_url;
};
if ($url = $model->checkRedirect($someOldUrl))
$this->redirect($url, 301);