• 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 Rewrite subfolder nginx

Marcio Nunes

Basic Pleskian
Hi,
We need to develop some website multi language. Example: /en and /es

When install new Joomla or WordPress in subfolders, don't work the rewrite URL nginx. Show 404 in URL /en/anycontent

Joomla and WordPress have support to multi language, but in this situation, need new web (components specific don't support multi currency, USD and EUR).

How fix? What's directive nginx can use to work URL rewrite for all subfolder?

Thanks
 
Marcio I really hope you solved your situation by now, but I run into your topic and there's no solution yet. I ran into a comparable issue.

I'm going to
1) explain my situation
2) explain the solution

I had a site at domain
a WP domain/sub1
multple WPs at domain/sub1/sub2

So I needed a regex which allows for all three possibilities.
Here's the edited standard

if (!-e $request_filename) {
set $test P;
}
if ($uri !~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon|internal-nginx-static-location)) {
set $test "${test}C";
}
if ($test = PC) {

rewrite ^((/\w+/)?(\w+)?)?(.*)$ $2$3/index.php?$4;

}


So it makes the subdomain and subsubdomain optional and saves them in variables by group capture.

this works for domain and subsubdomain but not subdomain.

Obviously it can't tell the difference between

domain/sub1/hello-world

and

domain/sub1/sub2

Maybe that's just not possible. I 'solved' the issue by moving all from the subfolder to the sub subfolder (nvm the nomenclature and conflagration between subdomain and folder)

For single-dept subdomains, I think you should use

rewrite ^(/\w+/?)?(.*)$ $1/index.php?$2;
 
Last edited:
Back
Top