Need help to convert rewrite url apache's

Igor Sysoev igor at sysoev.ru
Tue Apr 26 22:43:33 MSD 2011


On Tue, Apr 26, 2011 at 10:07:33AM -0400, Gimly wrote:
> Hi All,
> 
> I'am new user, so actually I test NGinX in my labs for delete apache2 in
> my production webserver. I've small htaccess rules and I want to convert
> it in NGinX rewrite rule.
> 
>   RewriteRule ^$ index.html [QSA]
>   RewriteRule ^([^.]+)$ $1.html [QSA]
>   RewriteCond %{REQUEST_FILENAME} !-f
>   RewriteRule ^(.*)$ index.php [QSA,L]
> 
> If anyone can help me please ? 

location = / {
    try_files  /index.html  =404;
}

location / {
    try_files  $uri  $uri.html  /index.php;
}

location = /index.php {
    fastcgi_pass   ...
    fastcgi_param  SCRIPT_FILENAME  /path/to/index.php;
    include        fastcgi_params;
}


-- 
Igor Sysoev



More information about the nginx mailing list