0
votes

Hello i am trying to remove index.php from yii project . i have installed wamp 2.4 x64 and enable mod_rewrite apache module and .htaccess file on my root path is give below

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

and url manager array in my main configuration file main.php is

 'urlManager' => array(
        'urlFormat' => 'path',
        'showScriptName' => false,
        'caseSensitive' => false,
        'rules' => array(
            '<controller:\w+>/<id:\d+>' => '<controller>/view',
            '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
            '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
        ),
    ),

but url work only in case i include index.php , an suggestion will be helpful thanks in advance

1

1 Answers

0
votes

Most likely it's due to the fact that your application is running under a sub-directory and not in the root folder, e.g. http://localhost/myapp/

In that case, you also need to specify RewriteBase in your htaccess like this.

RewriteBase /myapp/ right after RewriteEngine on

Change the path above as per your actual path.