yii Setting in your main.php file How to remove index.php in url.

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Removed the commented lines for rewrite in httpd.conf file.

LoadModule rewrite_module modules/mod_rewrite.so

You can modify .htaccess file your application folder.

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

after you can change your main.php file code.

<?php
return array(
    // application components
    'components'=>array(
            // uncomment the following to enable URLs in path-format
            'urlManager'=>array(
                'urlFormat'=>'path',
                'showScriptName'=>false,
                'rules'=>array(
                    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
                ),
                'urlSuffix'=>'.html',
                'caseSensitive'=>false
            ),
    ),
);
?>


Got any yii Question?