I am triying to set friendly URL for a domain but it seems I am doing someting wrong,
can anyone please help?
here is the content of my urlManager array in the config/web.php
‘urlManager’ => [
‘enablePrettyUrl’ => true,
‘showScriptName’ => false,
‘rules’ => [
‘http://www.domain.com/men’ => ‘?category=3’,
‘http://www.domain.com/women’ => ‘?category=2’,
],
]
Your actual requirement is to have URL friendly or for some specific url rewrite?
Then just do it in your .htaccess file
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
Then in your config/web.php change the URL Mananger
The problem is that i want to be able to choose any friendly name independently from the controller names and actions, is that possible?
Or maybe I am not getting you well?
But not when i add an additional GET parameter like this for example ‘http://www.example.com/login’ => ‘site/login?u=10’,
Any hint on that? how can I pass additional parameter without having to modify my action method or add a parameter to the action method?