0

It's me again :( I was trying to install siwapp on my webserver but I couldn't make it work with nginx, here is the .htaccess file content:

RewriteCond %{REQUEST_FILENAME} !index.php
RewriteRule (.*)\.php$ index.php/$1


RewriteCond $1 !^(index\.php|nhototamsu|assets|cache|xd_receiver\.html|photo|ipanel|automap|xajax_js|files|robots\.txt|favicon\.ico|ione\.ico|(.*)\.xml|ror\.xml|tool|google6afb981101589049\.html|googlec0d38cf2adbc25bc\.html|widget|iradio_admin|services|wsdl)

RewriteRule ^(.*)$ index.php/$1 [QSA,L]

When I access http://myurl.com/tin-tuc/tuyen-sinh/tu-van/2012/04/25757-phan-van-qua-giua-khoi-a1-va-khoi-a.html ,nginx could display the page correctly, it said: "404 Not Found" (new URL: http://myurl.com/tin-tuc/tuyen-sinh/tu-van/2012/04/25757-phan-van-qua-giua-khoi-a1-va-khoi-a.html)

3 Answers 3

3

Looks like a pretty standard config to me ...

location / {
    try_files $uri $uri/ @rewrite;
}
location @rewrite {
    rewrite ^/(.*)$ /index.php/$1;
}
location ~ \.php$ {
    try_files $uri $uri/ /index.php?$args;
    include fastcgi_params;
    fastcgi_pass localhost:9000;
}
0

This website tool helped me a lot

Please gather some understanding of how rewrite works from nginx wiki here. Trust me it is always a good idea

0

I can give you a real example.

Apache's .htaccess:

Rewriterule ^(articulos)/([0-9]+)/([a-zA-Z0-9_-]+)$ index.php?modules=full_post&id=$2 [NC,L,QSA]

Nginx equivalent:

location / {
    try_files $uri $uri/ @rewrite;
}
location @rewrite {
    # Dinamic Links
    rewrite ^/(articulos)/([0-9]+)/([a-zA-Z0-9_-]+)$ /index.php?modules=full_post&id=$2;
}

I hope this helps you!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .