yii2: How can I configure Url manager when using module and GET parameters? -
i trying configure url's in modules getting 404 error on accessing following url's. products page url example:
http://localhost/jambomall/web/products/products/details-product?deal_key=nvx3ftqf&url_title=3-jojo-cat-ponted-heels
i want url manager show this:
http://localhost/jambomall/web/products/details-product/nvx3ftqf/3-jojo-cat-ponted-heels
how can configure url manager display this? not working me.
'products/<deal_key:\w+>/<url_title:\w+>' => 'products/products/details-products'
here web.php
'urlmanager' => [ 'class' => 'yii\web\urlmanager', 'showscriptname' => false, 'enableprettyurl' => true, 'rules' => [ 'products/<deal_key:\w+>/<url_title:\w+>' => 'products/products/details-product', ], ],
and .htaccess
in web folder
rewriteengine on # if directory or file exists, use directly rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # otherwise forward index.php rewriterule . index.php
your .htaccess seems ok. see below configuration. may work you.
'urlmanager' => [ 'class' => 'yii\web\urlmanager', 'enableprettyurl' => true, 'showscriptname' => false, 'rules' => array( '' => 'site/index', 'module/<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>', '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ), ],
Comments
Post a Comment