1

At the moment i have a glossar controller with an actionAnzeige()-method.

For this action i need GET-paramter named item.

Now i could use this url: www.xy.de/glossar/anzeigen?item=programming

But i want to use this: www.xy.de/glossar/programming

I've added this route to the rules:

'glossar/<item:\d+>'=>'glossar/anzeigen',

and now i can generate the url i want to use:

<?php echo Yii::app()->createUrl('glossar/anzeigen', array('item' => $glossarItem->Url)); ?>

But if i visit the created url, i get a 404 error.

2 Answers 2

3

You have to use w+ instead of d+ since item takes letters instead of digits

'glossar/<item:\w+>'=>'glossar/anzeigen',
Sign up to request clarification or add additional context in comments.

Comments

3

You can use this, which accepts characters or numbers:

'glossar/<item:.+>'=>'glossar/anzeigen',

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.