Mention of htaccess missing in routing section of tyhe guide.

I have just set up my first Yii2 app to check it out. The first issue I have run into is to do with Routing, and although I’ve solved it I thought I would bring it up in case others have the same issue and to suggest that the documentation be updated.

The problem is that I turned pretty urls on, as per the instructions in the guide, only it didn’t work:

I used composer to create a standard basic web app. This is what went into the web.php config

        'urlManager' => [

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            'enableStrictParsing' => true,

            'rules' => [

                '<controller:\w+>/<action:\w+>' => '<controller>/<action>'



I invented the rule line as the guide jumps straight into more complex rules and doesn’t suggest this basic catchall that will work with the actions in the ‘basic’ app.

Only it didn’t work. If I added a rule for the home page, then just that page worked but I couldn’t get any other rule to work. The module was obviously working because the urls in the nav of the homepage were in pretty format as expected.

'' => 'site/index',

After scratching my head for a while and poking around a bit I realized that there was no htaccess file in the web folder, so I copied one across from another yii project, and now it works fine.

Options +FollowSymLinks

IndexIgnore */*

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 [L]

The guide mentions nothing about htaccess and I don’t know why a default one wasn’t created when the app was built with composer. Was a htaccess file supposed to be created? am I doing something wrong? Or does the guide need updating to mention the need of a htaccess file when using pretty urls? I’m on Windows 7 using a wamp setup.

(Yii2 is looking great other than this. Thanks to the team for all the good work.)