перевести правила переписывания apache2 - PullRequest
1 голос
/ 04 декабря 2011

у меня есть этот файл .htaccess для apache:

# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f

# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]

как я могу преобразовать его в .htaccess для nginx?

я пробовал с этим:

  location / {
    rewrite ^/$ /index.html;
    rewrite / /RewriteRule;
    rewrite ^/(.*)$ /index.php last;
  }

Вы считаете правильным?

Большое спасибо!

1 Ответ

0 голосов
/ 05 декабря 2011

Вам не нужно переписывать для таких вещей, просто try_files .

try_files /index.html$is_args$args $uri.html$is_args$args $uri /index.php$is_args$args;
...