Подскажите пожалуйста.
Есть сайт, работает хорошо, с недавних пор понадобилось из одной директории сайта сделать редирект на index.php этой диретокрии от несуществующих файлов/директорий в ней.
В апаче все просто, в директории сайта api создаешь .htaccess с таким содержимым.
Код: Выделить всё
Options +FollowSymLinks
IndexIgnore /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.phpКод: Выделить всё
server {
        listen 1.0.1.2:80;
        root /usr/local/www/default;
}
server {
        listen 1.0.1.2:80;
        server_name www.ru;
        error_log /var/log/nginx/www.error_log info;
        root /usr/local/www/www.ru/web;
        index index.php index.html index.htm default.html default.htm;
        open_file_cache max=15024 inactive=60s;
        open_file_cache_valid 300s;
        open_file_cache_min_uses 2;
        open_file_cache_errors on;
location / {
	try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
        fastcgi_pass unix:/tmp/www.sock;
        fastcgi_index index.php;
        include fastcgi_params;
	fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
#       fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_ignore_client_abort off;
	try_files $uri =404;
}
location /pma/ {
        alias /usr/local/www/phpMyAdmin/;
        index index.php;
        auth_basic           "closed site";
        auth_basic_user_file /usr/local/.htpasswd;
location ~ \.php$ {
        fastcgi_pass unix:/tmp/www.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_ignore_client_abort off;
        fastcgi_param PHP_ADMIN_VALUE "xcache.cacher=Off";
        fastcgi_param PHP_ADMIN_VALUE "xcache.stat=Off";
        fastcgi_param PHP_ADMIN_VALUE "xcache.optimizer=Off";
   }
}
location /api {
    index index.php;
    try_files $uri $uri/ /api/index.php?$args;
}
location ~ /\.(ht|svn|git) {
        deny all;
}
}Так же пробовал и такой варинат.
При таком вовсе не работает.
Код: Выделить всё
location /api/ {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php;
}
}Спасибо за понимание.


