PHPackages                             migratetoflarum/canonical - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. migratetoflarum/canonical

ActiveFlarum-extension[HTTP &amp; Networking](/categories/http)

migratetoflarum/canonical
=========================

Create redirects to the canonical url of your forum

1.0.0(4y ago)55.1k↑50%1[5 PRs](https://github.com/migratetoflarum/canonical/pulls)MITJavaScript

Since Mar 13Pushed 3y agoCompare

[ Source](https://github.com/migratetoflarum/canonical)[ Packagist](https://packagist.org/packages/migratetoflarum/canonical)[ RSS](/packages/migratetoflarum-canonical/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (13)Used By (0)

Canonical Url extension by MigrateToFlarum
==========================================

[](#canonical-url-extension-by-migratetoflarum)

[![MIT license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/migratetoflarum/canonical/blob/master/LICENSE.md) [![Latest Stable Version](https://camo.githubusercontent.com/53c2db13a12811e27561909a836c0eeca637ebea84a076913ce64a69df833032/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696772617465746f666c6172756d2f63616e6f6e6963616c2e737667)](https://packagist.org/packages/migratetoflarum/canonical) [![Total Downloads](https://camo.githubusercontent.com/c062bbc3dd075b24fb6e69c4db5eda5561778afa90b719f16b993f80738b6b2b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696772617465746f666c6172756d2f63616e6f6e6963616c2e737667)](https://packagist.org/packages/migratetoflarum/canonical) [![Donate](https://camo.githubusercontent.com/0d6e4d8b50b5983a58205941b1a581b1305903393b7a39da574e3f60af3c7f5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d79656c6c6f772e737667)](https://www.paypal.me/clarkwinkelmann)

This extensions creates redirects so that Flarum can only be accessed via the url defined in `config.php`.

> **First note:** your host might already be doing those redirects for you. If that's the case, then you don't need this extension.

> **Second note:** if your host supports configuring redirects (via Apache Rewrites or Nginx server rules for example), I recommend using that instead of an extension for better performance. If those features are not available or if you don't have the technical knowledge to use them, then this extension is for you!

> **Third note:** this extension does not work with Flarum installs in subfolders.

Installation
------------

[](#installation)

```
composer require migratetoflarum/canonical
```

Updating
--------

[](#updating)

```
composer require migratetoflarum/canonical
php flarum cache:clear
```

Documentation
-------------

[](#documentation)

To enable the redirects, first enable the extension in your Flarum dashboard. Then access the extension settings and select a redirect status.

The extension settings will only be available when you access the forum via the canonical url. This should prevent you from getting locked outside of the forum if Flarum cannot actually be reached via the url defined in `config.php`.

Before continuing, you should make sure the `url` value in `config.php` is the URL you want as canonical. In particular if HTTPS is enabled on your host (as it should), make sure the canonical url includes `https://`.

You should first enable the temporary redirect option, so you can test the redirects without them being cached in every browser and search engine browsing the forum. If your forum uses a bare domain (no `www.` subdomain), try accessing the `www.` subdomain and you should be redirected with a 302 status. If your forum uses a `www.` subdomains, try accessing the bare domain (without `www.`).

Likewise, if your forum uses an HTTPS canonical url (again, as it should), trying to access it via `http://` should result in a 302 redirect to `https://`.

Once you confirmed everything is okay, you can switch the redirect status to permanent. The redirect status code will be switched from 302 to 301. Browsers and search engines will cache those redirects and stop to consider those pages as duplicates.

After all of this is done you can also submit your forum for a scan on the [MigrateToFlarum Lab](https://lab.migratetoflarum.com/) as an additional check 😉.

Rescue mission
--------------

[](#rescue-mission)

If you somehow get locked out of your forum because of a faulty redirect, here's what you can do:

- If you changed your forum hostname, update the `url` value in `config.php` and the extension will now redirect to that new url
- If you need to disable the redirects but don't have access to the dashboard anymore, you can manually edit the `migratetoflarum-canonical.status` entry in the `settings` table of your forum database. Set the value to `0` to disable the redirects

In any case, if a permanent redirect was cached and prevents you from accessing the address you need, you might have to clear:

- Your browser cache
- Cloudflare cache or the cache of other proxies your website is using
- If a search engine cached an incorrect redirect, you'll have to wait for it to expire or try to manually submit the page to the search engine for a new try

A MigrateToFlarum extension
---------------------------

[](#a-migratetoflarum-extension)

This is a free extension by MigrateToFlarum, an online forum migration tool (launching soon). Follow us on Twitter for updates

Need a custom Flarum extension ? [Contact Clark Winkelmann !](https://clarkwinkelmann.com/flarum)

Links
-----

[](#links)

- [Flarum Discuss post](https://discuss.flarum.org/d/19307)
- [Source code on GitHub](https://github.com/migratetoflarum/canonical)
- [Report an issue](https://github.com/migratetoflarum/canonical/issues)
- [Download via Packagist](https://packagist.org/packages/migratetoflarum/canonical)

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~134 days

Recently: every ~78 days

Total

7

Last Release

1810d ago

Major Versions

0.2.4 → 1.0.02021-05-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/0538135c1debcef5602dce7ece027909cc832b7a6284ab9189a19aa8de98d60d?d=identicon)[clarkwinkelmann](/maintainers/clarkwinkelmann)

---

Top Contributors

[![clarkwinkelmann](https://avatars.githubusercontent.com/u/5264300?v=4)](https://github.com/clarkwinkelmann "clarkwinkelmann (9 commits)")

---

Tags

urlextensionflarumcanonical

### Embed Badge

![Health badge](/badges/migratetoflarum-canonical/health.svg)

```
[![Health](https://phpackages.com/badges/migratetoflarum-canonical/health.svg)](https://phpackages.com/packages/migratetoflarum-canonical)
```

###  Alternatives

[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

538204.9M23](/packages/league-uri-interfaces)[flarum-lang/russian

Russian language pack for Flarum.

13126.1k](/packages/flarum-lang-russian)[flarum-lang/french

French language pack to localize the Flarum forum software plus its official and third-party extensions.

2033.8k](/packages/flarum-lang-french)[kyrne/websocket

Integrated Pusher replacement.

121.6k1](/packages/kyrne-websocket)[flarum/gdpr

Features for GDPR, PII management

1425.2k15](/packages/flarum-gdpr)[fof/subscribed

Additional user subscriptions for your forum

1327.5k2](/packages/fof-subscribed)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
