Pretty Url Not Working

I’ve verified that Apache & the mod_rewrite is working properply with the following snippet:




RewriteEngine On

Options +FollowSymLinks

RewriteRule ^test\.html http://www.google.com/? [R=301,L]



I’m using the advanced Yii2 template and my .htaccess reads:




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



My url config:




object(yii\web\UrlManager)[58]

  public 'enablePrettyUrl' => boolean true

  public 'enableStrictParsing' => boolean false

  public 'rules' => 

    array (size=0)

      empty

  public 'suffix' => null

  public 'showScriptName' => boolean false

  public 'routeParam' => string 'r' (length=1)

  public 'cache' => string 'cache' (length=5)

  public 'ruleConfig' => 

    array (size=1)

      'class' => string 'yii\web\UrlRule' (length=15)

  private '_baseUrl' => null

  private '_hostInfo' => null

  private '_events' (yii\base\Component) => 

    array (size=0)

      empty

  private '_behaviors' (yii\base\Component) => null



But still the browsers address field shows: "http://testproject.dev/index.php?r=site/login".

What am I missing?

This is what the debugger tells me (pretty URL not enabled at row 6):




1	21:03:17.343	trace	yii\base\Application::bootstrap	Bootstrap with yii\log\Dispatcher

2	21:03:17.343	trace	yii\base\Module::getModule	Loading module: debug

3	21:03:17.347	trace	yii\base\Application::bootstrap	Bootstrap with yii\debug\Module::bootstrap()

4	21:03:17.348	trace	yii\base\Module::getModule	Loading module: gii

5	21:03:17.348	trace	yii\base\Application::bootstrap	Bootstrap with yii\gii\Module::bootstrap()

6	21:03:17.350	trace	yii\web\UrlManager::parseRequest	Pretty URL not enabled. Using default URL parsing logic.



However, when I print the contents of Yii::$app->getComponents(), i get the following under ‘urlMananger’:




    [urlMananger] => Array

        (

            [class] => yii\web\UrlManager

            [showScriptName] => 

            [enablePrettyUrl] => 1

            [rules] => Array

                (

                    [site/offers] => category/index

                )


        )




Are you sure you’re setting up the config properly? I had some issues until I figured out how console/backend/frontend configs worked. (They inherit and override from common)

I assumed that it did not matter where I put the urlMananger component (and after moving it between the following with the same results:

common/config/main.php

backend/config/main.php

…I concluded that something else was causing this.

Could you perhaps share your insights regarding the different configuration files?