pehalwaan
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.