• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.

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