I've been writing a technical book, but after Chapter 1 I realised that it would be more useful to people as a searchable online resource.

I imagine that the customer subscribes and can then search the content for solutions.

So my question is how do I protect online content and charge monthly for access to the content. Is there a service I can use, or script or...?

In practice the content will be created by H&M HTML output, so I probably only need to protect access to a directory.

Dani AI

Generated

A concise, practical path from your static book files to a subscription product — building on ’s CMS suggestion and ’s “send a link” idea. There are two safe, commonly used architectures: (A) run a membership-capable CMS (fast to launch, plugins handle billing and user management), or (B) keep your H&M/static HTML output but put an authentication layer and a server-side search in front of it (better for preserving your existing workflow and avoiding accidental public indexing).

If you choose the static-output route, avoid mailing permanent links. Permanent links are easy to share or index. Instead either: (1) proxy access through a small app that verifies the subscriber session and streams the static files; or (2) host files in private object storage and return short‑lived signed URLs for authenticated sessions. Both let you use webhooks from a payment provider (Stripe/PayPal/Memberful, etc.) to create/disable accounts automatically.

A minimal PHP example that enforces a login before serving a protected HTML file:

<?php
session_start();
if (empty($_SESSION['user_id'])) {
  header('Location: /login.php?redirect=' . urlencode($_SERVER['REQUEST_URI']));
  exit;
}
$file = __DIR__ . '/protected/' . basename($_GET['file']);
if (is_readable($file)) {
  header('Content-Type: text/html');
  readfile($file);
  exit;
}
http_response_code(404);
?>

Search: do not ship a full-text index to the browser (client-side indexes leak content). Instead index your HTML into a server-side search store (Postgres FTS, Elasticsearch/Meili, or a lightweight SQLite FTS) and expose a /search API that checks session tokens. Operational items to plan for: HTTPS everywhere, short-lived tokens, rate limiting, logging, and backups. Those steps give a professional subscription experience while keeping your original authoring workflow intact.

Recommended Answers

All 4 Replies

Member Avatar for Member #46692

Once payment has been processed you send them a link to the content. The content might be stored in the db so it won't be searchable by online resources.

Several content management systems, such as wordpress and joomla have modules you can use to mark pages as only available to subscribers (and to provide some pages marked as free to view that contain a free section from some of your content, so users can see if it is worth paying to get at your content).

Some of these modules / plugins are free as well. Just like Wordpress and joomla.

Install one, get members to pay a subscription, and put most of your content on the subscribers only pages.

Simples.

Have you never seen this done on a professional blog before? A pay to learn site?

Member Avatar for Member #46692

Thats a good point.

I have my own site () and have written technical books, but this is the first time I'm thinking of making a tehchical book "online". Those are good ideas joomla and wordpress, I'll investigate further, many thanks!

Simples!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.