• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved wordpress permalinks don't work with nginx

pacman94

New Pleskian
Hi, this rewrite rule doesn't work.
Code:
location / {
  try_files $uri $uri/ /index.php?$args;
}

this one works:
Code:
if (!-e $request_filename) {
rewrite ^.*$ /index.php?$args last;
}

why and what is the difference? boths are fine?
 
Hi pacman94,

actually, the ( correct / recommended! ) nginx directive:
Code:
    if (!-e $request_filename){
        rewrite ^(.*)$ /index.php break;
        }
OR
Code:
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php?q=$1 last;
        }

... are the basic rewrite directives, which should work in most cases. If you desire to learn more about NGINX directives, I recommend the official NGINX documentation at:



( Pls. keep in mind, that Plesk already uses ( standart ) location directives within the ( standart ) domain specific nginx configuration files, so that additional directives might conflict with already existing location directives. A location directive can only be used ONCE, so that "if" - statements can be used to add additional directives, without conflicting with earlier settings/configurations. ;) ).
 
Hi pacman94,

actually, the ( correct / recommended! ) nginx directive:
Code:
    if (!-e $request_filename){
        rewrite ^(.*)$ /index.php break;
        }
OR
Code:
    if (!-e $request_filename) {
        rewrite ^/(.*)$ /index.php?q=$1 last;
        }

... are the basic rewrite directives, which should work in most cases. If you desire to learn more about NGINX directives, I recommend the official NGINX documentation at:



( Pls. keep in mind, that Plesk already uses ( standart ) location directives within the ( standart ) domain specific nginx configuration files, so that additional directives might conflict with already existing location directives. A location directive can only be used ONCE, so that "if" - statements can be used to add additional directives, without conflicting with earlier settings/configurations. ;) ).

with this one can use nginx only for a site?
 
Hi Kingsley,

with this one can use nginx only for a site?
Your question is not clear enough, to be answered in general, as it depends very much on your ( unique ) content and your settings for your (sub)domain over the Plesk Control Panel.
 
Back
Top