Here are the rules I am using for the Url Manager.
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
'post/<arg1>/<arg2>/<arg3>/<arg4>' => 'post/filter',
'posts' => 'post/index',
],
],
And my .htaccess
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
The rule seems to be working and urls like
post/filter?arg1=9&arg2=0&arg3=d&arg4=3 is getting turned into,
post/9/0/d/3
However, I have a search form like below
$form = ActiveForm::begin([
'action' => Url::to(['post/filter']),
'method' => 'get'
the fields in the form are named arg1,arg2,arg3,arg4. Now whenevr I submit the form the url gets back to the format
post/filter?arg1=9&arg2=0&arg3=d&arg4=3
I am not sure if its got something to do with the rules or the way I am submitting the form (I need submit the form by GET method only). Any help? Thanks.