Forma LMS was built around a front controller that reads its state from query parameters. A typical course or login request arrives as index.php?modname=login&op=login or index.php?r=lms/course/play, and the application resolves the module internally. That architecture works, but it produces long, parameter-heavy URLs that search engines treat as low quality, that users struggle to copy and share, and that frequently generate duplicate-content signals when the same page is reachable through several parameter orderings. On a Managed Cloud shared plan running LiteSpeed, you can clean this up entirely from your hosting account without touching the server configuration, but the rewrite logic has to match how Forma dispatches requests or you will trap visitors in redirect loops and broken module pages.

The sections below cover why the raw URLs appear, how to enable the platform's own URL handling, how to add LiteSpeed-compatible rewrite and canonical rules through .htaccess, and how to diagnose the 404 and loop problems that show up once rewriting is active. Everything here runs under an unprivileged DirectAdmin account.

Why Forma LMS produces query-string URLs

Forma LMS routes almost every page through index.php in the document root, usually /domains/yourdomain.com/public_html/ on a DirectAdmin account. The dispatcher inspects parameters such as modname, op, r, and id_course to decide which controller and view to render. Because the routing table lives in PHP rather than in the web server, the default installation never needs rewrite rules at all, so it also never ships with a working .htaccess that maps clean paths back to those parameters.

Two problems follow from that. First, search engines index each parameter combination separately. A course landing page accessed as ?id_course=12&op=aula and the same page reached through an internal menu link with reordered parameters look like two distinct URLs to a crawler, which dilutes ranking and wastes crawl budget. Second, the public catalogue and course description pages that you actually want indexed sit behind the same opaque parameters as authenticated areas, so without explicit control you end up either exposing login-only endpoints to crawlers or blocking the pages you wanted found.

The goal is therefore not only to make URLs prettier but to separate the public, indexable surface of the LMS from the authenticated application and to give every public page a single stable address. On LiteSpeed this is achieved with mod_rewrite-compatible directives in .htaccess, which LiteSpeed reads natively, combined with the platform's own configuration flags.

Enabling friendly URLs and a correct base path

Before writing any rewrite rules, confirm which PHP version Forma LMS is running under. In DirectAdmin open MultiPHP Manager (or PHP Selector under CloudLinux) and verify the domain is set to a supported release such as PHP 7.4 or 8.1, with the mbstring, gd, and pdo_mysql extensions enabled through the Select PHP Extensions screen. A mismatched version will cause the front controller to throw errors that masquerade as URL faults.

Next, tell Forma LMS the absolute base address of the installation so that every link it generates is consistent. Using the DirectAdmin File Manager, open the main configuration file at /public_html/config.php and confirm the site URL constant reflects the canonical host, for example:

$GLOBALS['cfg']['url'] = 'https://yourdomain.com';
$GLOBALS['cfg']['folderpath_relative'] = '/';

If the LMS lives in a subfolder such as /public_html/lms/, the relative folder path must be /lms/ and every rewrite rule later has to use that same prefix. Mismatched values here are the single most common reason friendly URLs half-work: menu links point to clean paths while the dispatcher still expects the old folder, producing intermittent 404s.

Inside the AdminCP, go to Admin → Configuration → General settings and set the public site name and default language, then review Admin → Configuration → Advanced for any SEO or clean-URL toggle your build exposes. Not every Forma release ships the same switches, so if a dedicated option is absent you rely entirely on the rewrite layer described below rather than a built-in router rewrite.

Rewrite rules, canonicals and HTTPS enforcement

Create or edit .htaccess in the document root. LiteSpeed honours these directives without a restart. Start by forcing a single canonical host and scheme so that www, non-www, HTTP and HTTPS all collapse to one address, which removes the duplicate-content penalty at the source:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Force HTTPS
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]

# Route clean paths into the front controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^lms/([a-z0-9/_-]+)/?$ index.php?r=$1 [L,QSA]
</IfModule>

The two RewriteCond lines that test for an existing file or directory are essential on a shared platform: they let real assets under /files/, /themes/, and /appLms/ load directly instead of being swallowed by the router. The QSA flag preserves any legacy parameters so old indexed links keep resolving while you migrate.

To retire the old query-string URLs cleanly, add 301 redirects that map the most important legacy endpoints to their new clean equivalents. Place these above the front-controller rule so they run first:

# Redirect legacy catalogue URL to clean path
RewriteCond %{QUERY_STRING} (^|&)modname=catalogue(&|$) [NC]
RewriteRule ^index\.php$ /lms/catalogue? [R=301,L]

The trailing ? strips the original query string so the destination is genuinely canonical. Resist the urge to redirect authenticated endpoints such as login or the player; those should stay on index.php to avoid loops when the session layer rewrites the request internally. For pages you do not want indexed at all, add a robots directive rather than a redirect, and set a self-referencing canonical tag in your theme template at /public_html/themes/yourtheme/ so each public page declares its own preferred URL.

Generate an XML sitemap for the public catalogue by exporting the list of published course URLs from phpMyAdmin (query the course table for active entries), building a standards-compliant sitemap.xml, and uploading it to the document root through File Manager. Reference it from /public_html/robots.txt with a Sitemap: https://yourdomain.com/sitemap.xml line, then submit the URL in Google Search Console. For broader rewrite and canonical patterns that apply across LMS platforms, the ILIAS friendly URLs and SEO guide covers the same principles in a comparable shared-hosting context.

Diagnosing 404s and redirect loops

Once rewriting is live, test methodically rather than clicking randomly. A clean path that returns 404 almost always means the RewriteBase does not match the real installation folder, or that folderpath_relative in config.php disagrees with it. Correct both to the identical prefix and the mismatch disappears.

A redirect loop (the browser reports too many redirects) usually comes from the HTTPS block fighting a proxy header. On LiteSpeed behind the platform's load balancer, the %{HTTPS} variable can read as off even on a secure request. If you see looping, replace the HTTPS condition with a header test:

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

When a whole section breaks after editing .htaccess, consult the per-account log at /public_html/error_log or the one surfaced under DirectAdmin → Errors. Rewrite syntax faults and PHP fatals both land there with a timestamp, which lets you pin a failure to the exact edit. If raw PHP errors leak into page output, raise the error log target through a .user.ini file in the document root with log_errors = On and display_errors = Off, keeping diagnostics in the log and out of indexed pages.

Finally, after any URL change, recrawl the sitemap in Search Console and check the coverage report a few days later. Lingering 404s there point to internal menu links still emitting old parameters; update those templates under /public_html/themes/ so the clean paths become the only addresses the application ever produces.