Plesk

Set up redirects in Plesk with .htaccess or nginx directives

Create 301 redirects, force HTTPS and www, and add custom Apache and nginx directives in Plesk, with ready-to-use examples and how to avoid redirect loops.

IntermediatePlesk2 min read

Plesk serves websites with nginx in front of Apache by default. That gives you two places to put redirect and rewrite rules: the familiar .htaccess file for Apache, and Additional nginx directives in the panel. This guide explains which to use and gives working examples.

Before you start

  • Know your PHP handler: open the domain's Hosting & DNS → Apache & nginx settings. If Proxy mode is off and PHP is served by nginx, .htaccess is ignored.
  • Back up any existing .htaccess before editing.

Force HTTPS the easy way

Open the domain's SSL/TLS Certificates page (SSL It!) and switch on Redirect from http to https. This is cleaner than writing rules and survives CMS updates. Use rules only for more specific redirects.

Choose www or non-www

  1. Go to Websites & Domains and open Hosting & DNS → Hosting for the domain.
  2. Set Preferred domain to example.com or www.example.com.
  3. Click OK. Plesk adds a permanent 301 redirect for the other name.
  4. Redirects with .htaccess (Apache)

    Edit httpdocs/.htaccess in the File Manager. Redirect a single page:

    Redirect 301 /old-page/ https://example.com/new-page/

    Redirect a whole old folder using mod_rewrite:

    RewriteEngine On
    RewriteRule ^blog/(.*)$ https://example.com/news/$1 [R=301,L]

    Place custom rules above the WordPress block (# BEGIN WordPress) so they run first.

    Additional nginx directives

    1. Open Hosting & DNS → Apache & nginx.
    2. Scroll to Additional nginx directives.
    3. Enter rules, for example:
    location = /old-page/ { return 301 https://example.com/new-page/; }

    Click OK. Plesk tests the configuration and refuses to save if there is a syntax error, which protects other sites. nginx redirects are faster than Apache ones because the request never reaches Apache.

    Additional Apache directives

    The same page has Additional directives for HTTP and HTTPS. These go into the Apache virtual host and are useful for directives not allowed in .htaccess. Remember that HTTP and HTTPS are separate boxes – add the rule to both if needed.

    Check your redirects

    • Run curl -I http://example.com/old-page/ and look for 301 and the right Location header.
    • Test in a private browser window; browsers cache 301 redirects aggressively.

    Troubleshooting

    • ERR_TOO_MANY_REDIRECTS: two rules send visitors back and forth, often HTTPS redirect in Plesk plus another in .htaccess or Cloudflare set to Flexible SSL. Keep one HTTPS redirect and use Cloudflare's Full (strict) mode.
    • .htaccess has no effect: PHP or static files are served directly by nginx. Enable proxy mode or move the rule to nginx directives.
    • 500 after editing .htaccess: a typo or unsupported directive. Check the Log Browser for the exact line.
    • Let's Encrypt renewal fails: exclude /.well-known/acme-challenge/ from blanket redirects.

    Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.