S
S
Slash2018-05-08 20:23:00
Nginx
Slash, 2018-05-08 20:23:00

How to checkout Nginx code?

Goodnight!
Switched to Nginx, but Apache still works. The following code remained in .htaccess:

# URL Rewrite
<IfModule mod_rewrite.c>
  RewriteEngine On

  # Full path to your site
  RewriteBase /

  # Работа без ("index.php?do=")
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*) index.php?do=/$1
</IfModule>

Which I can't seem to translate into Nginx. In the Nginx config, I have the following locations:
location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @fallback;
    }
    location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
      try_files $uri $uri/ @fallback;
      expires 7d;
    }
    location / {
      try_files /does_not_exists @fallback;
    }
  }

Tell me, how can I arrange the code with .htaccess in Nginx?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Danil Sapegin, 2018-05-08
@ynblpb_spb

https://nginxconfig.io/

K
ky0, 2018-05-08
@ky0

https://nginx.ru/ru/docs/http/ngx_http_rewrite_mod...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question