• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

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