i'm trying to use Nginx to rewrite the url to more user friendly. Removing index.php?r= is success, but the problem is, after i tried to visit other page, it says 404 Not Found. I already add in the config/web the urlmanager for pretty url but its not working . Can someone help me with this?
i'll try to post the code .
this is the nginx.conf
server {
listen 88;
server_name localhost;
location / {
root html;
index index.php index.html index.htm;
rewrite ^(.*[^/])$ $1/ permanent;
try_files $uri $uri/ /index.php?r=$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ .php$ {
include fastcgi_params;
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
}
and this is the url manager .
'urlManager' => [
'class' => 'yii\web\UrlManager',
// Disable index.php
'showScriptName' => false,
// Disable r= routes
'enablePrettyUrl' => true,
'rules' => array(
'<controller:\w+>/<id:\d+>' => '<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
'<controller:\w+>/<action:\w+>' => '<controller>/<action>',
),
],
I tried this at my localhost first .
Thank You.
/var/www/html/yii-app/web;instead ofhtml;htmlto/html/yii-app/web, this is the error i get in error.log..2016/02/23 10:13:53 [error] 3116#1344: *2 "C:/html/MAPUser/web/MAPUser/web/index.php" is not found (3: The system cannot find the path specified)i place my nginx in C: