Link to home
Start Free TrialLog in
Avatar of pehalwaan
pehalwaanFlag for Afghanistan

asked on

Nginx Rewrite rule

I want to convert apache .htaccess to nginx for my website.

Apache Htaccess- ( Below htaccess is in my manager folder of apache document root )

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]

Nginx ( Below is what I have written but its not working )

location /manager {
        if (!-d $request_filename){
        set $rule_0 1$rule_0;
        }
        if (-e $request_filename.php){
        set $rule_0 2$rule_0;
        }
        if ($rule_0 = "21"){
        rewrite ^(.*?)/?$ $1.php last;
        }

Please suggest.
ASKER CERTIFIED SOLUTION
Avatar of Zephyr ICT
Zephyr ICT
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial