Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Routing not working in production evironment

Hi,

I just moved from development to production. I realized my routing is not working in the production environment. I am using a LEMP stack.

Can anyone guide me in the right direction?

This is my nginx configuration.

server {

    listen   80;
    server_name localhost;
    charset utf-8;
    index index.php index.html index.htm;
    set $root_path '/usr/share/nginx/ppl/public';
    root $root_path;

    try_files $uri $uri/ @rewrite;

    location @rewrite {
        rewrite ^/(.*)$ /index.php?_url=/$1;
    }

    location ~ \.php {
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index /index.php;
        #fastcgi_pass 127.0.0.1:9000;
        include /etc/nginx/fastcgi_params;

        fastcgi_split_path_info       ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO       $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
        root $root_path;
    }

    location ~ /\.ht {
        deny all;
    }
}

Here is my routing code snippet.

$di->set('router', function () {
    $router = new Router();

    $router->add(
        '/list/([0-9]+)/([a-z0-9\-]+)',
        array(
            'controller' => 'Listing',
            'action'     => 'detailed',
            'id' => 1,
            'title' => 2

        )
    );   
    $router->add('/', array(
        'controller' => 'Listing',
        'action' => 'home'
    )); 

    $router->removeExtraSlashes(true);
    return $router;
},true);

I am able to access the controller and respective actions via url.

Is there anything important that i am missing?

Thanks all.



34.8k
edited Nov '14

What is url not working ?



12.1k

/ and /list -> the ones in the routes..



34.8k

change Listing to be listing



12.1k

THAT WORKS! i cant believe that. Why is it case senstive? its working well in WAMP?



34.8k
Accepted
answer
edited Nov '14

it's WAMP on windows, but your production system is Linux, so it's case sensitive