Custom Nginx rules?

I’d like to include some custom nginx configs and rules. So far, I know that I need to include them in /var/www/example.com/conf/nginx

But, if some rules overlap, will they be overwritten? Which file has the highest priority?

I’d want to have some custom 301 redirects, how do I do that? my main domain is https://example.com and I want to 301 custom (non-wordpress) pages:

Redirect https://www.example.com/page3.html to https://example.com/3page.html How do I do that?

Rules loaded earlier take precedence over rules loaded later.

If you want to ensure your rules will be evaluated first, you should ee site edit domain.com and move the last include to above the standard ones.

The redirect you want can be achieved by:

location ^/page3.html {
    return 301 https://example.com/3page.html
}
1 Like

That nginx rule doesn’t really work in my setup. I have SSL enabled via EE and everything works fine. But, along with my WordPress, I have a simple, custom html page inside a directory.

When accessing that page, the http to https redirection works fine, but the www to non-www doesn’t.

When adding the rule you proposed, it still doesn’t work.

Any tips/pointers?

I’d like to redirect https://www.mydomain.com/example to https://mydomain.com/example

When I added your rule, I got a “too many redirects” error