• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Issue htaccess to nginx Not Working (WordPress 404s)

Mark Bailey

Basic Pleskian
Hi All,

The htaccess to nginx extension is not working for us...I want to make sure we're not missing something.

We have done multiple tests where users create a new WordPress install, then switch it from Apache to nginx in Plesk. Upon moving to nginx, all sub-pages throw 404 errors if WordPress permalinks are active. Of course the issue is that permalinks use .htaccess, so apparently the extension is not converting .htaccess directives to nginx syntax. It was our understanding that this extension does all this "automagically," though I can't remember where I saw that.

Or is there something that needs to be done in a certain order with each site? We are trying to make things as easy and automatic as possible for our hosting clients.

Thanks,

Mark
 
extension does all this "automagically"
Hello Mark,

Unfortunately htaccess to nginx does no magic with existing htaccess files. One needs to proceed to 'Websites & Domains' -> 'Apache & nginx Settings' and put some additional configuration to make Wordpress permalinks work on nginx. The extension will help you to convert your htaccess content into nginx configs, that you may apply on the same screen.

Typical Wordpress rewrites should be converted to
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;
}

If you install Wordpress into a subfolder of your website document root, rewrite should be `rewrite /. /<SUBFOLDER>/index.php last;`

You may also configure your Service Plan to automatically set these directives (at Web Server tab) and install Wordpress (at Additional Services tab). Existing sites should be fixed manually though.
 
Back
Top