N
N
Nepofigist2011-03-19 23:25:43
Nginx
Nepofigist, 2011-03-19 23:25:43

ReWrite and nginx

Good evening,

On the advice of Habr, I moved to nginx. Everything flies, except for the only nuance - I can’t translate the rewrite rules in .htaccess into the nginx language in any way. Namely, this: Help, please, with the translation. Thank you.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1


Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dzuba, 2011-03-19
@Dzuba

Something like this:
location / {
try_files $uri $uri/ index.php;
}

B
bekbulatov, 2011-03-20
@bekbulatov

try it
location / {
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
}

H
Horse, 2011-03-20
@Horse

rewrite ^/(.*)$ /index.php?$1 last;
only for statics you will need a separate location, well, or check through if

Z
zizop, 2011-03-20
@zizop

I have an Nginx config for web hosting (Nginx+php5-fpm+Memcached) . Just your case, in my opinion :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question