Overview

This article covers how to set custom HTTP Headers for your website, using a .htaccess file located in your website’s file directory.

HTTP Headers let you supply additional info in HTTP requests – this could for example be used to fine-tune how your site loads, or to help protect your site with an additional layer of security.

Instructions

  1. Log into Plesk either via your Conetix Account, or directly into your VPS (if you have one).
  2. Navigate to the File Manager under the website you’d like to configure HTTP Headers for.
setting http headers for a website
  1. Navigate to the folder that contains your website’s files;
    • If you only have one website located within your hosting plan, it will be located within the httpdocs folder.
    • If you have more than one website within your hosting plan, choose the folder that has the name of the website. If no such folder exists for the site, it will therefore likely be within the httpdocs folder.
setting http headers for a website
  1. Click on the .htaccess file located within the site’s files, to open and edit it.
    • If the file doesn’t already exist, click the blue Plus button, and choose Create File;
      setting http headers for a website
    • Name it “.htaccess” (without the quotes), then click OK.
      setting http headers for a website
    • Then, click on the newly created .htaccess file to start editing it.
      setting http headers for a website
  2. Scroll to the bottom of the .htaccess file’s code, and add a starting line of;
    # HTTP Headers
    This is simply used to help you (or your developer) identify where your HTTP Headers have been set.
  3. Add the opening line of;
    <IfModule mod_headers.c>
    Your HTTP Headers will then be located under this line.
  4. Add your HTTP Headers as required – Plesk has a list of example headers that you may wish to consider looking at.
  5. Once you have added all of the required lines for each of your HTTP Headers, add the following line below them;
    </IfModule>
setting http headers for a website
  1. Click Save to save your changes.
setting http headers for a website
  1. Open your website in a new tab or window to confirm that the new HTTP Headers are working as expected.
Was this article helpful?

Related Articles