Applicable to:
- Plesk for Linux
Question
On a Plesk for Linux server, it is required to configure redirect from Web Server's Default Page, or website that exists in Plesk to Plesk login page.
How can it be done?
Answer
NOTE: Configuring above redirect will result in inability to issue/renew Let's Encrypt certificate since Let'S Encrypt can process requests only with ports 80/443: to be able to use Let's Encrypt certificates redirects need to be disabled.
-
Login to the server using SSH.
-
Create the file
/var/www/vhosts/default/htdocs/.htaccess
:# touch /var/www/vhosts/default/htdocs/.htaccess
-
Add the following content to it using text editor:
CONFIG_TEXT: RewriteEngine On
RewriteCond %{HTTP_HOST} ^203.0.113.2$
RewriteCond %{HTTP_HOST} ^203.0.113.3$
RewriteRule ^.*$ https://example.com:8443/ [R,L]
Redirect 301 / https://example.com:8443/Note: 203.0.113.2, 203.0.113.3 and example.com should be replaced with public IP addresses and hostname of the server respectively.
-
Go to Domains > example.org > Apache & nginx Settings.
-
Add the following additional directives:
-
If the field Additional nginx directives is present, add the following content to it's beginning:
CONFIG_TEXT: return 301 https://example.com:8443/;
-
If the field Additional nginx directives is absent, add the following content to both fields Additional directives for HTTP and Additional directives for HTTPS:
CONFIG_TEXT: Redirect "/" "https://example.com:8443/"
Note: example.com should be replaced with the hostname of the server.
-
Comments
0 comments
Please sign in to leave a comment.