So im trying to build a way to redirect several pages as the slugs are not correct anymore(translation issues), as this project is an webshop I wanted to manage 301 thru the webshop backend(advanced template) instead of manually insert everything in to the .htaccess file. Every redirect is set on the on the page of each product.
I know that yii offers a redirecting tool but I can use some ideas on this issue. What is the best way to do this?
Any tips, idea’s help is nice
If I understand your question, you have several urls managed by a page with action named (for example) "actionMyPage" that catches also bad request (with no more existent slug).
$slug = \Yii::$app->request->get('slug');
$model = Model::find()->andWhere(['slug' => $slug])->one();
if($model == null)
// the slug does not exist anymore. I'll do redirect...
// the model from slug exists, so I'll render the page