0

My yii application was installed in virtual host(http://yii.loc) (WAMP). I need to remove index.php from url. But only http://yii.loc url works, the other pages says "Not Found".

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

.htaccess

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

2 Answers 2

3

Check out the settings of Apache. I had same problems when the rewrite rule was disabled.

Go to WAMP icon->Apache modules->rewrite_module and turn it on

Than try to restart your WAMP & aplication in browser)

Sign up to request clarification or add additional context in comments.

2 Comments

AllowOverride must also be enabled in the site configuration
rewrite_module is enabled, AllowOverride too, but get the result "Not Found".
0

Got a solution. By mistake I have changed the .htaccess which are located in protected folder. So I restored the file

deny from all

The I created a new .htaccess file in the root directroy and add

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

And now it works.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.