redirect - 404 error on nginx location directive -


i trying convert apache redirection directives nginx one, have following directive:

server {   listen          80;   index           index.php index.html;   server_name     myvisit_head;   root            /var/www/mv/head/myvisit/;   access_log      /var/log/nginx/myvisit-access.log;   error_log       /var/log/nginx/myvisit-error.log;    # use gzip compression   # gzip_static       on;  # uncomment if compiled nginx using --with-http_gzip_static_module   gzip                on;   gzip_disable        "msie6";   gzip_vary           on;   gzip_proxied        any;   gzip_comp_level     5;   gzip_buffers        16 8k;   gzip_http_version   1.0;   gzip_types          text/plain text/css application/json application/x-javascript text/xml application/$    # error pages   error_page   500 502 503 504  /50x.html;   location = /50x.html {     root   /var/www;   }    # deny access hidden files   location ~* /\.ht {     deny            all;     access_log      off;     log_not_found   off;   }    location / {     try_files $uri $uri/ /index.php?$args;   }    location ~* /myvisitv3 {     rewrite /(myvisitv3|myvisitv3|myvisitv3|myvisitv3)([-_])(.*).(html|php)$ /myvisitv3.php?libadresse=$3 break;   }    # pass php scripts on php-fpm   include global/php-fpm.conf;   location ~* \.php$ {     try_files       $uri /index.php;     fastcgi_index   index.php;     fastcgi_pass    php5-fpm-sock;     include         fastcgi_params;     fastcgi_param   script_filename    $document_root$fastcgi_script_name;     fastcgi_param   script_name        $fastcgi_script_name;     fastcgi_param   php_value          "auto_prepend_file=/var/www/profile/external/header.php \n                                         auto_append_file=/var/www/profile/external/footer.php";     include /etc/nginx/fastcgi_params;   } } 

but when try access url 404 not found error. have tried both location, request_uri directive result same here's apache rules:

rewriteengine on rewriterule ^(myvisitv3|myvisitv3|myvisitv3|myvisitv3)([-_])(.*).(html|php)$    myvisitv3.php?libadresse=$3 [l,qsa] rewriterule ^(openvisit|openvisit).(html|php)$                                  openvisitv3.php             [l,qsa] rewriterule ^(favicon).(ico|png|bmp|jpg)$                                       web/img/favicon.ico         [l,qsa] 

these rules use case insensitive matching spare hassle of handling many cases.

location ~* /myvisitv3[-_](.*)\.(?:html|php) {     try_files $uri $uri/ /myvisitv3.php?libadresse=$1; }  location ~* /openvisit\.(?:html|php)$ {     try_files $uri $uri/ /openvisitv3.php; }  location ~* /favicon\.(?:ico|png|bmp|jpg)$ {     try_files $uri $uri/ /web/img/favicon.ico; } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -