Issue
I would like to create an url like this: http://domain.com/index.php/hir/2015-02-12/news_title
Here is my urlmanager what doesn't work:
'urlManager'=>array(
'urlFormat'=>'path',
'rules'=>array(
'hir/<date:\d+>/<title:\w+>'=>'news/view',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
And here is my .htaccess:
Options +FollowSymLinks
IndexIgnore */*
<IfModule mod_rewrite.c>
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
</IfModule>
RewriteEngine on
Solution
No need to .htacces file, you can solve this by url-manager. Just change your first url-manager rule like this:
'hir/<date:\d+>/<title:\w+>'=>'news/view' TO 'hir/<date>/<title>'=>'news/view'
I think this will help you.
Answered By - hamed
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.