Set Up Redirects in Plesk

redirects

Redirects are essential when you want to ensure a smooth user experience and maintain SEO value after making changes to your website structure, domain, or URLs.

Whether you’re migrating to a new domain, switching from HTTP to HTTPS, or simply reorganizing your site’s pages, Plesk offers several ways to manage redirect.

Set Up Redirects in Plesk: A Step-by-Step Guide

In this guide, we’ll cover how to set up different types of redirects in Plesk.

Types of Redirects:

  • 301 Redirect (Permanent): Tells search engines and browsers that a page has permanently moved to a new location. It preserves SEO ranking.
  • 302 Redirect (Temporary): Indicates that the page has temporarily moved. It’s used for short-term changes, but doesn’t transfer SEO value.
  • URL Forwarding: Redirect visitors from one domain to another.

Method 1: Using Plesk’s Hosting Settings to Redirect a Domain

If you want to redirect an entire domain (or subdomain) to another URL, Plesk makes it easy with built-in hosting settings.

Steps:

  1. Log in to Plesk.
  2. Navigate to Domains and select the domain you want to configure.
  3. Click on ‘Hosting Settings’.
  4. In the ‘Preferred Domain’ section, choose the URL format (with or without “www”) you want to use and redirect the opposite one to it.
  5. Scroll down to the ‘Permanent SEO-Safe 301 Redirect’ section.
  6. Select the checkbox to enable a 301 redirect if you’re switching to HTTPS.
  7. Save changes.

This method is ideal for simple domain redirection and changing URL formats.

Method 2: Creating Redirects via .htaccess (for Apache Servers)

For more granular control over individual URLs, you can create custom redirects using the .htaccess file. This method is commonly used for Apache servers.

Steps:

  1. Log in to Plesk.
  2. Navigate to ‘Files’ and select your website’s root directory (usually httpdocs).
  3. Look for an existing .htaccess file. If it doesn’t exist, create a new file by clicking ‘New’ > ‘Create File’.
  4. Open the .htaccess file for editing.
  5. Add the following code to create a redirect:
    • For a 301 Redirect from one URL to another:
Redirect 301 /old-page.html http://www.example.com/new-page.html
  1. For a 302 Redirect:
Redirect 302 /temporary-page.html http://www.example.com/new-page.html
  1. Save the file and test your redirect.

This method allows you to target specific pages and use both permanent and temporary redirects as needed.

Method 3: Using Plesk’s Extension for Redirect Management

For those who prefer a more user-friendly approach, Plesk offers extensions like SEO Toolkit that simplify redirect management.

Steps:

  1. Log in to Plesk and go to the ‘Extensions’ section.
  2. Search for and install an extension like SEO Toolkit or other redirect management tools.
  3. Once installed, navigate to the extension interface.
  4. Follow the prompts to set up redirects within a visual interface, avoiding manual edits to .htaccess.

This is an ideal solution for users who want to manage large-scale redirects or need assistance with SEO.

Method 4: Redirect Using Nginx Configuration (for Nginx Servers)

If your website is running on Nginx instead of Apache, you will need to modify the Nginx configuration for redirects.

Steps:

  1. Log in to Plesk.
  2. Navigate to ‘Domains’ and click on ‘Apache & Nginx Settings’ under your domain.
  3. Scroll down to the ‘Additional Nginx directives’ section.
  4. Add the following directive for a 301 Redirect:
rewrite ^/old-page$ http://www.example.com/new-page permanent;
  1. Save changes.

This method is efficient for handling redirects on Nginx servers without relying on .htaccess.

Common Use Cases for Redirects:

  1. Redirect from HTTP to HTTPS: Ensures all traffic is directed to the secure version of your website.
    • For Apache:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  1. For Nginx:
if ($scheme = http) {
    return 301 https://$server_name$request_uri;
}
  1. Redirect to www or non-www: Ensures consistent URL formatting.
    • For Apache
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  1. For Nginx
server {
    listen 80;
    server_name example.com;
    return 301 http://www.example.com$request_uri;
}
  1. Redirect outdated or renamed pages: If a page is moved or renamed, ensure users are redirected to the new location without hitting a 404 error.

Conclusion

Plesk offers multiple methods to manage redirects, from simple domain-level redirection through the interface to more complex URL-level redirects via .htaccess or Nginx directives. These tools and approaches ensure smooth navigation for users and maintain SEO rankings after URL or site structure changes.