Skip to content

Cookie settings

Choose which kinds of cookies you allow. You can change your choice at any time via Cookie settings at the bottom of every page. Privacy statement

Necessary

Always on

Needed to log in, keep your cart and remember your choices. These are always on.

Which cookies?
  • weboke_sessie, weboke_klant, weboke_remember: your session and staying logged in
  • weboke_basket: your cart
  • wkBtwIncl: showing prices with or without VAT
  • wok_cookies: your cookie choice, 12 months

Measures which ad leads to a visit or order, so we do not pay for ads that do nothing.

Which cookies?
  • Google Ads via Google Tag Manager (_gcl_au, _gcl_aw), up to 90 days
  • OpenAI Ads, ads in ChatGPT
  • wok_aff: which partner referred you to us (affiliate programme), 60 days

4.6

Country and language

Each country has its own site, with prices and VAT for that country.

View

Protecting digital downloads in WooCommerce

Selling an e-book, a PDF, music or software through WooCommerce? Then you want only paying customers to be able to get the file. WooCommerce handles this with a protected download link, but that only works properly if the download method is secure and the folder holding the files is locked down. Here you can read how it works, what to configure and how to check that a direct link doesn't work.

How a download works in WooCommerce

On a product, tick Downloadable and upload the file. WooCommerce puts it in the folder wp-content/uploads/woocommerce_uploads/. By default it appends a random string of characters to the file name, so the name is hard to guess. The customer never gets that address, but a link to your shop instead. On every click, WooCommerce checks whether the download belongs to a paid order and whether the limit and the expiry date haven't been reached yet. Only then does the customer get the file.

If nothing is shipped by post, also tick Virtual. That way WooCommerce won't charge shipping costs.

Choose a secure download method

Go to WooCommerce > Settings > Products > Downloadable products and look at the File download method:

MethodWhat happensSecure?
Force downloads (default)PHP reads the file and sends it to the customer itself.Yes. With very large files, PHP may hit its time limit.
X-Accel-Redirect/X-SendfilePHP does the check, the web server sends the file.Yes, if the web server supports it.
Redirect onlyThe customer is sent to the actual address of the file.No. Anyone who has the address can share it. WooCommerce itself calls it insecure.

Choose Force downloads, unless you're sure X-Sendfile works. Also leave the option that makes WooCommerce fall back to redirecting as a last resort switched off.

The woocommerce_uploads folder must be locked down

With a secure method, the folder itself must be closed to regular visitors. Otherwise someone who knows the file name, for example from a leaked link, can fetch the file directly. That's why WooCommerce places two files in the folder during installation:

  • an empty index.html, so no list of files can be seen;
  • a .htaccess with the rule deny from all, which refuses all direct requests.

Such a .htaccess file works on web servers that read it, such as Apache and LiteSpeed. Our servers run on LiteSpeed, so at WebOké this protection works without any extra settings. On a server running nginx, the web server doesn't read .htaccess; there a rule in the server configuration is needed. If you later move your shop to such a server, check it again.

The .htaccess file is hidden. To see whether it's there, see Showing and editing hidden files such as .htaccess. Don't delete it.

Checking that a direct link doesn't work

  1. On a downloadable product, open the file address as WooCommerce shows it. It starts with /wp-content/uploads/woocommerce_uploads/.
  2. Open that address in a private window where you're not logged in.
  3. A 403 Forbidden error (or 401 or 404) is good. If you can simply view or download the file, the folder is open.

Always test a real file, not just the folder. A blank page for the folder may be the empty index.html, while the files themselves are still accessible. You can also do it from the command line: curl -I https://example.com/wp-content/uploads/woocommerce_uploads/bestand.pdf should return a 403. You can read what a 403 means in Forbidden (403): You don't have permission to access / on this server.

The folder is included in every backup and every copy. So a test environment (staging) also contains your paid files. Protect it with a password. See A test environment (staging) for your webshop.

Limits and access

  • You set the Download limit and Download expiry per product or variation. Empty means unlimited. A strict limit restricts sharing, but leads to complaints when someone buys a new computer.
  • Access after payment is on by default: the customer can download as soon as the payment has succeeded.
  • Approved download directories: only files from these folders or addresses may be used as downloads. Keep the list short.

If you sell digital content to consumers, also arrange how the right of withdrawal works for downloads. WooCommerce doesn't do this automatically. You'll find an explanation in the free course A webshop with WooCommerce, lesson 5.2 The right of withdrawal: 14 days and the model form. This article is not legal advice; check with your country's consumer authority (in the Netherlands, the ACM) or ask a lawyer.

Further reading

Want to learn more? Take the free course A webshop with WooCommerce, lesson 3.3 Digital and virtual products.

Was this article helpful?

← Back to General hosting

One moment…

Set up your domains

For each domain, arrange the nameservers, the link to your hosting and who becomes the owner.

Loading your domains…