Skip to content
  • Contact us: +34 944 58 06 58
  • Plesk Partner Program
  • Plesk Lifecycle Policy
  • Blog
  • Contact us
  • Plesk 360
  • Contact us: +34 944 58 06 58
  • Plesk Partner Program
  • Plesk Lifecycle Policy
  • Blog
  • Contact us
  • Plesk 360
  • Solutions
    By Role
    • Developers
    • Content Managers
    • Digital Agencies
    • IT Admins
    • Web Hosters
    • Hyperscalers
    • Developers
    • Content Managers
    • Digital Agencies
    • IT Admins
    • Web Hosters
    • Hyperscalers
    By Edition
    • Web Admin Edition
    • Web Pro Edition
    • Web Host Edition
    • Business & Collaboration
    • Plesk WP Edition
    • Web Admin Edition
    • Web Pro Edition
    • Web Host Edition
    • Business & Collaboration
    • Plesk WP Edition
    By Cloud
    • Amazon Web Services
    • Microsoft Azure
    • Alibaba Cloud
    • GCP Marketplace
    • Vultr
    • DigitalOcean
    • Linode
    • UpCloud
    • Amazon Web Services
    • Microsoft Azure
    • Alibaba Cloud
    • GCP Marketplace
    • Vultr
    • DigitalOcean
    • Linode
    • UpCloud
    Partner Program
    Exclusive discounts, benefits and exposure to take your business to the next level
    Become a partner
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    Explore Features
    • Everyone
    • Admins & Web Hosters
    • Developers
    • Designers & Agencies
    • Plesk Features
    • Everyone
    • Admins & Web Hosters
    • Developers
    • Designers & Agencies
    • Plesk Features
    Key Topics
    • SocialBee
    • WP Toolkit
    • Sitejet Builder
    • SEO Toolkit
    • Joomla! Toolkit
    • Plesk Premium Email
    • Plesk Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder
    • SEO Toolkit
    • Joomla! Toolkit
    • Plesk Premium Email
    • Plesk Email Security
    Feature Packs
    • Business & Collaboration
    • WP Pack
    • Hosting Pack
    • Power Pack
    • Language Pack
    • Business & Collaboration
    • WP Pack
    • Hosting Pack
    • Power Pack
    • Language Pack
    Featured Extension
    SocialBee
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • Extension
  • Pricing
  • Extensions
  • Help Center
  • More
    • Careers
    • Events
    • Plesk University
  • FREE TRIAL
  • Solutions
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder
      • SEO Toolkit
      • Joomla! Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • SocialBee
  • Pricing
  • Extensions
  • Help center
  • More
    • Careers
    • Events
    • Plesk University
    • Blog
    • Plesk Partner Program
    • Contact Us
  • FREE TRIAL
  • Solutions
    • By Role
      • Developers
      • Content Managers
      • Digital Agencies
      • IT Admins
      • Web Hosters
      • Hyperscalers
    • By Edition
      • Web Admin Edition
      • Web Pro Edition
      • Web Host Edition
      • Business & Collaboration
      • WP Edition
    • By Cloud
      • Amazon Web Services
      • Microsoft Azure
      • Alibaba Cloud
      • GCP Marketplace
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
    • Partner Program
      • Partner Program
  • Product
    • Explore Features
      • Everyone
      • Admins & Web Hosters
      • Developers
      • Designers & Agencies
      • Plesk Features
    • Key Topics
      • SocialBee
      • WP Toolkit
      • Sitejet Builder
      • SEO Toolkit
      • Joomla! Toolkit
      • Plesk Premium Email
      • Plesk Email Security
    • Feature Packs
      • Business & Collaboration
      • WP Pack
      • Hosting Pack
      • Power Pack
      • Language Pack
    • Featured Extension
      • SocialBee
  • Pricing
  • Extensions
  • Help center
  • More
    • Careers
    • Events
    • Plesk University
    • Blog
    • Plesk Partner Program
    • Contact Us
  • 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.

Tweet
Share
Share
Email
0 Shares
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

Industry
Partners

industry-partner_ALIBABA
industry-partner_GOOGLEPARTNER
industry-partner_MICROSOFT
industry-partner_REDHAT-r2
industry-partner_ALIBABA
industry-partner_AUTOMATTIC
industry-partner_AWS
industry-partner_DIGITALOCEAN
industry-partner_SCALEWAY
Follow us:
Facebook Twitter Linkedin Youtube Github

COMPANY

About Plesk
Our Brand
Legal
Careers
Impressum

PRODUCT

Pricing 
Extensions
What’s new

KNOWLEDGE BASE

Documentation
Help Center
Migrate to Plesk
Contact Us
Hosting Wiki
Preview releases

PROGRAMS

Contributor Program NEW
Partner Program
Affiliate ProgramNEW

COMMUNITY

Blog
Forums 
Plesk University

First defaul

Company

About Plesk
Our Brand
Legal
Careers
Impressum

PRODUCT

Pricing 
Extensions
What’s new

KNOWLEDGE BASE​

Documentation
Help Center
Migrate to Plesk
Contact Us
Hosting Wiki
Preview releases

PROGRAMS​

Contributor Program NEW
Partner Program
Affiliate ProgramNEW

COMMUNITY​

Blog
Forums
Plesk University

Follow us:
Facebook Twitter Linkedin Youtube Github

© 2025 WebPros International GmbH. All rights reserved. Plesk and the Plesk logo are trademarks of WebPros International GmbH.

Managed with love with Plesk WP Toolkit