Nginx URL Rewrites for subdomain

cherimos

New member
Joined
Jun 9, 2025
Messages
2
Hi,

Is there a simple way to add Nginx URL Rewrites for a subdomain?
I know I can add a sub-domain as a domain But I would rather use the sub-domain section to add the rewrites.

Is this easy to do?
 
Hello,

Use the tool Admin Level -> Custom HTTPD Configuration -> domain.com to edit the Nginx configuration -> Customize and add this code into a text area of your choice (depending what you want to modify):

Probably it will be CUSTOM1 section

Code:
|*if SUB="zzzz"|
    # custom code goes here
|*endif|

where zzzz is the name of your subdomain .

This way you can not re-define existing locations. But if you need to add additional code into the location /, use the section CUSTOM2

Other way you might use templates: https://docs.directadmin.com/webservices/nginx/customizing-nginx.html
 
Back
Top