A
A
antonre2012-03-22 19:33:35
Nginx
antonre, 2012-03-22 19:33:35

Rewrite in Nginx

Hello. I have a question:

There is a website site.ru.
It is necessary that when accessing site.ru/Text , rewrite to site.ru/go.php?action=Text

Little experience with rewrite nginx - I don’t know the subtleties.

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
avalak, 2012-03-22
@antonre

More or less like this.

location / {
  try_files $uri $uri/ @php; # try to find the file, if it doesn't exist, go to the named location
}
## for php-fpm
[email protected] {
  ## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  fastcgi_pass php_backend; #upstream

  ## fastcgi_params
  include fastcgi_params;
  fastcgi_param QUERY_STRING action=$uri&$query_string;
  fastcgi_param SCRIPT_FILENAME $document_root/go.php;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question