Question
How to redirect IP address to domain name URL on Plesk for Linux server?
Answer
Note: Replace example.com and 203.0.113.2 with the actual domain name and IP address. If you do not have administrative access to Plesk server, contact your hosting provider.
- Log in to Plesk.
- Specify the domain example.com in the field Default site in the menu Tools & Settings > IP Addresses > 203.0.113.2:
-
Add the following directive to the field Additional nginx directives in Domains > example.com > Apache & nginx settings and click OK or Apply at the bottom of the page:
if ($host ~ '203.0.113.2'){
rewrite ^/(.*)$ https://example.com/$1 permanent;
}