I am trying to rewrite yii addresses but no luck. I spent hours going through sites, and each time I came up with the same answer, which does not work for me:
http://www.yiiframework.com/doc/guide/1.1/en/topics.url#user-friendly-urls
I would like to allow urls for base paths like
/index.php/site/index in /
/index.php/ads and /index.php/ads/ in / ads
/ advertisement / details? Ads = 9 in / ad / 9
The problem is that .htaccess has no effect.
I use:
mamp pro
on mac with a lion and the web directory is different from the root web server . I installed AllowOveride through the console.
.htaccess is located in the same folder as the main index.php, but it does not register even if I create an error.
I had no problems with other non-yii web directories using htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php
//main.php
'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>',
),
),
source
share