• Inviting everyone who uses WordPress management tools in Plesk
    The Plesk team is conducting a 60-minute research session that includes an interview and a moderated usability test.
    To participate, please use this link .
    Your experience will help shape product decisions and ensure the tools better support real-world use cases.

Nginx with custom permalinks - Wp-login.php - Too many redirects

Xavier12

Regular Pleskian
Hey guys,

For some reason we are having nginx issues. We've used apache to nginx converter and custom permalinks do work, however, when logging in to Wordpress dashboard, we receive a "too many redirects" error. It seems to only work when we type in: http://domain.com/wp-admin/index.php

Code:
#ignored: "-" thing used or unknown variable in regex/rew

if (!-f $request_filename){
    set $rule_1 1$rule_1;
}
if (!-d $request_filename){
    set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
    rewrite /. /index.php last;
}

Please advise, thanks.
 
What worked for my was adding a rule specifically targeting the /wp-admin folder

#ignored: "-" thing used or unknown variable in regex/rew

if (!-f $request_filename){
set $rule_1 1$rule_1;
}
if (!-d $request_filename){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){

rewrite ^/wp-admin/(.*)\.php$ /wp-admin/$1.php last; #<==== this line

rewrite /. /index.php last;

}
 
Back
Top