'Can not access prestashop admin menu except dashboard

I installed prestashop in my localhost. I can login to admin and saw the dashboard. But when I went to other menu, it said 404 not found. The problem was in dashboard, it is using url like index.php?controller , but in other menu it is using admin/index.php. I installed the software under ps directory.

OK - http://localhost/ps/admin/index.php?controller=AdminDashboard&token=3fca2bcd5f31ce3c1cdf951bf5620720#/preview FAIL - http://localhost/ps/admin/index.php/sell/catalog/products?_token=IIPIHFzRMTdRMvjXGeCiFocCWVXBiwUhWgJIAhgzvtA

Here is my nginx default site configuration inside server {}

location /ps {
        root /var/www/;
        index index.php;
        #try_files $uri $uri/ =404;
        try_files $uri $uri/ /index.php?$args;
location ~ /ps/(.+\.php)$ {
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        include snippets/fastcgi-php.conf;
        }
}

I am using nginx version 1.18.0 and prestashop version 1.7.8.3 on ubuntu 20.04.4.

My question is, how to fix the nginx setting especially the try_files part so that I can access prestashop's other menu? If that is not possible, how to disable pretty url in prestashop?



Solution 1:[1]

Prestashop comes with built-in Apache rewriting rules, so using a NGINX only enviroment could be troublesome.

You preferably have to switch to Apache as-persystem requirements : https://devdocs.prestashop.com/1.7/basics/installation/system-requirements/ or consider using Nginx as a reverse proxy for static resources and Apache to serve PHP requests, so native htaccess will work out of the box.

Anyway , have a look at Nginx-specific Prestashop rules:

https://devdocs.prestashop.com/1.7/basics/installation/nginx/

to be integrated in your conf file.

While, in order to completely disable URL rewriting, you can act on a backoffice setting "URL rewriting" in SEO&URL part, if you are not able to reach that page, you can just adjust "PS_REWRITING_SETTINGS" to 0 in ps_configuration table in your database.

I'm not sure if this will work with the backoffice routes that are now based on Symfony framework, though.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3256843