3

Зашел в небольшой тупик.

Если перемещаться по страницам сайта, то они открываются, но если попытаться открыть конкретную ссылку, то выводится 404. Причем иногда может открыться, а может и не открыться. Поисковые боты как я понял попадают как раз 404 ошибку.

Используется UMI 2.7 + nginx + php-fpm.

Вот конфиг nginx:

server {
        listen 80;

        root /var/www/co/;
        index index.php;

        server_name geberit24.ru www.geberit24.ru;

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }


        location ~* \/\.ht {
                deny all;
        }
        location ~* ^\/(classes|errors\/logs|sys\-temp|cache|xmldb|static|packages) {
                deny all;
        }

        location ~* (\/for_del_connector\.php|\.ini|\.conf)$ {
                deny all;
        }
        location ~* ^(\/files\/) {
                try_files $uri =404;
        }
        location ~* ^(\/images\/) {
                access_log off;
                expires 7d;
                add_header Pragma public;
                add_header Cache-Control "public";
                try_files $uri =404;
        }

        location ~* ^\/images\/autothumbs\/ {
                try_files $uri @autothumbs =404;
        }

        location @autothumbs {
                rewrite ^\/images\/autothumbs\/(.*)$ /autothumbs.php?img=$1$query_string last;
        }
        location @clean_url {
                rewrite ^/(.*)$ /index.php?path=$1 last;
        }
        location @dynamic {
                try_files $uri @clean_url;
        }
        location / {
                rewrite ^\/robots\.txt /sbots.php?path=$1 last;
                rewrite ^\/sitemap\.xml /sitemap.php last;
                rewrite ^\/\~\/([0-9]+)$ /tinyurl.php?id=$1 last;
                rewrite ^\/(udata|upage|uobject|ufs|usel|ulang|utype|umess|uhttp):?(\/\/)?(.*)? /releaseStreams.php?scheme=$1&path=$3 last;
                rewrite ^\/(.*)\.xml$ /index.php?xmlMode=force&path=$1 last;
                rewrite ^(.*)\.json$ /index.php?jsonMode=force&path=$1 last;
                if ($cookie_umicms_session) {
                        error_page 412 = @dynamic;
                        return 412;
                }
                if ($request_method = 'POST') {
                        error_page 412 = @dynamic;
                        return 412;
                }
        }
        location ~* \.js$ {
                rewrite ^\/(udata|upage|uobject|ufs|usel|ulang|utype|umess|uhttp):?(\/\/)?(.*)? /releaseStreams.php?scheme=$1&path=$3 last;
                try_files $uri =404;
                expires 7d;
                add_header Pragma public;
                add_header Cache-Control "public";
        }
        location ~* \.(ico|jpg|pdf|jpeg|png|gif|swf|css)$ {
                access_log off;
                expires 7d;
                add_header Pragma public;
                add_header Cache-Control "public";
                try_files $uri =404;
        }
}

curl -I http://geberit24.ru/katalog/unitaz-bide/kryshka-bide/kryshka-bide_geberit_aquaclean_5000plus/

HTTP/1.1 404 Not Found Server: nginx/1.4.6 (Ubuntu) Date: Wed, 09 Sep 2015 18:53:39 GMT Content-Type: text/html Content-Length: 177 Connection: keep-alive

2 ответа 2

3

После долгого изучения .htaccess Помогло добавление следующего:

 location @backend {
                rewrite ^ /index.php?path=$uri&$args;
        }
        location / {
                try_files $uri @backend;
                ....
        }
0
0

Возможно проблема в этой строчке: try_files $uri =404;

Попробуйте заменить на try_files $uri $uri/ /index.php?$args;

1
  • Увы, но не помогает. 11 сен 2015 в 18:06

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.