axtho
axtho

Reputation: 15

Yii2 UrlManager rules do not rewrite media files

I am using an app template based on the advanced template (frontend, common, backend). In the common's main.php (common/config/main.php) I have set a rule to map a particular url (ssid/) to site/index?ssid=. Here is the rule:

'urlManager' => [
     'enablePrettyUrl' => true,
      'showScriptName' => false,
      'rules' => [
          'ssid/<ssid:[\w\-]+>' => 'site/index',
          '<ssid:[\w\-]+>/<path:(.*)\.(jpg|jpeg|png|gif)>'=>'/<path>',
       ]
  ]

The problem I am trying to address with the second rule is that links to media files, such as

<img src="sources/logos/logo.png" />

end up as ssid/sources/logos/logo.png.

However I am skinning this cat, it always prefixes the ssid before the path.

Help? Please? o_o

Upvotes: 0

Views: 41

Answers (0)

Related Questions