A
A
Appp Zooo2014-02-03 13:04:38
Yii
Appp Zooo, 2014-02-03 13:04:38

Yii urlManager hide 'index.php/site' from link?

I can't remove 'index.php/site' from the link in any way,
Now it's like this: localhost/yii/cya/index.php/site/restaurants
Need: localhost/yii/cya/restaurants
Standard rule:


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

(tried .htaccess - but with any configuration it gives permission denied).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Appp Zooo, 2014-02-05
@ikeagold

Here is the solution:

Options Includes FollowSymLinks
#hide index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

'urlManager'=>array(
  'urlFormat'=>'path',
  'showScriptName'=>false,
  'rules'=>array(
    // стандартное правило для обработки '/' как 'site/index'
    '' => 'site/index',
    // это пример добавления который заработал
    //'secondcontroller/<action:.*>'=>'secondcontroller/<action>',
    'user/<action:.*>'=>'user/<action>',
    //'<action:.*>'=>'site/<action>', //закомментил а то глючило с ним
    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
  ),
),

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question