• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Resolved NGINX and Wordpress

omexlu

Regular Pleskian
Hello,

I have trouble with NGINX and Wordpress rewrite, it works with my configuration but on wp-admin i have to many redirects:

My htaccess before:
Code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

My nginx directive:
Code:
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;
}

Whats the problem here? I have generated this with the plesk extension.

Thanks
 
Hi omexlu,

if you experience issues ( because of caching- or any other other used wordpress - plugins ), you could add:

Code:
    if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        rewrite ^(/[^/]+)?(/wp-.*) $2 last;
        rewrite ^(/[^/]+)?(/.*\.php) $2 last;
    }
 
Like that?:

Code:
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;
}

if (!-e $request_filename) {
       rewrite /wp-admin$ $scheme://$host$uri/ permanent;
       rewrite ^(/[^/]+)?(/wp-.*) $2 last;
       rewrite ^(/[^/]+)?(/.*\.php) $2 last;
   }
 
Hi omexlu,

well, I recommend to use the "standart" - like for example:

Code:
    if (!-e $request_filename) {
        rewrite ^(.+)$ /index.php break;
        }

    if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        rewrite ^(/[^/]+)?(/wp-.*) $2 last;
        rewrite ^(/[^/]+)?(/.*\.php) $2 last;
        }
 
Back
Top