Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • WP Guardian
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • WP Guardian
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • WP Guardian
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • WP Guardian
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

How to configure redirect from domain name/IP address to server hostname on port 8443 in Plesk for Linux?

 
domain namedomainshostedhttphttps

Question

How to configure a redirect from the domain name/IP address to the server hostname on port 8443 in Plesk for Linux?

How to set up the following redirects in Plesk:

https://example.com:8443 => https://hostname.com:8443
https://203.0.113.2:8443 => https://hostname.com:8443

where:

  • "example.com" is any domain hosted on the Plesk server and resolved to it.

  • "hostname.com" is Plesk server hostname.

  • "203.0.113.2" is Plesk IP address.

Answer

  • To configure the redirect from the server IP address to the server hostname:

    https://203.0.113.2:8443 => https://hostname.com:8443

    Perform the following steps

    1. Connect to the server using SSH.

    2. Create the file /etc/sw-cp-server/conf.d/z-plesk.inc:

      # touch /etc/sw-cp-server/conf.d/z-plesk.inc

    3. Open the file /etc/sw-cp-server/conf.d/z-plesk.inc via any text editor and add the following lines to it:

      if ($host ~ '203.0.113.2'){
      rewrite ^/(.*)$ https://hostname.com:8443/$1 permanent;
      }

      Note: Replace 203.0.113.2 with the correct Plesk server's IP address, and hostname.com with the real Plesk server's hostname.

    4. Restart services sw-cp-server and sw-engine to apply changes:

      # service sw-cp-server restart && service sw-engine restart

      Note: Even after the redirect is set up and Plesk is secured by an SSL certificate, an attempt to access https://203.0.113.2:8443 in a browser will end up with the error regarding the untrusted certificate. It is expected behaviour and happens because the redirect is performed after the certificate check.

  • To configure the redirect from a domain name to the server hostname:

    https://example.com:8443 => https://hostname.com:8443

    Perform the following steps

    Note: If the domain(s) have HTTP Strict Transport Security (HSTS) enabled, disable it before applying the steps below.

    1. Connect to the server using SSH.

    2. Create the file /etc/sw-cp-server/conf.d/z-plesk.inc:

      # touch /etc/sw-cp-server/conf.d/z-plesk.inc

    3. Open the file /etc/sw-cp-server/conf.d/z-plesk.inc via any text editor and add the following lines to it:

      if ($host ~ 'example.com'){
      rewrite ^/(.*)$ https://hostname.com:8443/$1 permanent;
      }

      Note: Replace example.com with the correct website that resolves to Plesk server's IP address, and hostname.com with the real Plesk server's hostname

      For redirect from all hosted domains names to https://hostname.com:8443, add the following directives:

      if ($host !~ 'hostname.com|127.0.0.1|localhost'){
      rewrite ^/(.*)$ https://hostname.com:8443/$1 permanent;
      }

    4. Restart services sw-cp-server and sw-engine to apply changes:

      # service sw-cp-server restart && service sw-engine restart

      Note: Even after the redirect is set up and the website is secured with an SSL certificate, in an attempt to access https://example.com:8443 in a browser will end up with the error regarding the untrusted certificate. It is expected behaviour and happens because the redirect is performed after the certificate check.

Read the full article
Related Posts

Exploring Plesk’s Added Value Solutions So Far in 2023

Read More »

Unveiling Sitejet Builder: The Perfect Match for Your Effortless Website Creation Needs

Read More »

Dynamic List vs. Active List: A Comprehensive Comparison – Unveiling the Ultimate Winner!

Read More »
Knowledge Base

How to customize Plesk URL

Read More »

Unable to set up an email account hosted in Plesk in an email client when a domain is behind Cloudflare: The connection to the server failed

Read More »

How to redirect webmail of all domains to a specific webmail URL in Plesk for Linux

Read More »

 An operation fails in Plesk: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘X’ for key ‘PRIMARY’

Read More »

Hosting Wiki

  • Content Security Policy ( CSP )
  • Server Redundancy
  • Linux Containers
  • Bare Metal Server
  • Oracle VM Server
  • Server Virtualization Software
  • Windows Server
  • Linux
  • JavaScript
  • HTTP/3
  • HTTP/2
  • Domain
  • Plesk
  • Lighttpd
  • Web Server
  • DNS Server
  • IPv6
  • IPv4
  • SIP
  • SSL
  • SSH
  • UDP/IP
  • TCP/IP
  • HTTP
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family