Long Nextcloud share links are a hard sell. A URL like https://cloud.example.com/index.php/s/aBcDeFg12345678 looks like something a phisher would send, is awkward to read out over the phone, and wraps badly on a printed handout. If you run your own server, you can fix that without handing your links to a third-party shortener: Shortcloud is a Nextcloud plugin that gives every public share a short address on your own domain and redirects it to the real share. This tutorial walks through installing it, wiring up the rewrite rule, and using the day-to-day features: automatic short links for new and old shares, custom endings, extra short domains, QR codes, expired shares that answer 410 Gone, and hiding /index.php from your addresses.
Everything below comes from the product documentation. If you want the full reference, see the user guide and the product page.
What problem it solves
A short link such as cloud.example.com/go/abc1234 is easy to type, easy to print and looks like it belongs to your organization. Shortcloud creates one automatically for every new public link share — whether the share was made from the web interface, the desktop client or a mobile client. Your domain stays your domain, and the redirector is your own server, not a public shortening service.
Prerequisites
- Nextcloud 32 to 34 with PHP 8.1 or newer.
- One rewrite rule in your web server. On Apache with
mod_rewriteandAllowOverride All, the app writes it into Nextcloud's.htaccessitself and keeps it there across upgrades. On nginx or a virtual host, the settings page shows the snippet you need to add. - For an extra short domain: DNS pointing to the server, a TLS certificate and a virtual host (the settings page shows it).
- A license key from your MediaLab Works account — you can start the free 30-day trial from the app.
Step 1 — Install and enable the app
Download the archive shortcloud-x.y.z.tar.gz from Licenses in your account, then extract it into your apps folder so you end up with apps/shortcloud/, owned by the web-server user:
cd /var/www/nextcloud/apps
sudo tar -xzf ~/shortcloud-x.y.z.tar.gz
sudo chown -R www-data:www-data shortcloud
Enable it:
sudo -u www-data php occ app:enable shortcloud
You can also enable it from the Apps page.
Step 2 — Activate the license
Open Administration settings → Shortcloud → License, paste your license key and save. The app contacts the license server, binds the key to this Nextcloud instance and shows the license as Active.
Worth knowing: the license is checked once a day. Without internet the app keeps working for 7 days after the last successful check; after that it stops until it can check again. Without a valid license nothing is deleted — every short link is kept and works again as soon as the license is valid, and only the License section stays usable in the meantime.
Step 3 — Make sure the rewrite rule works
Nextcloud does not let a third-party app answer at /go/… by itself, so one rewrite rule sends those requests to the app. On Apache with a writable .htaccess the app writes it on the first request after enabling. Open Administration settings → Shortcloud: the page tests the short address over HTTP and tells you whether the rule works, offers Install rewrite rule, and shows the snippet for nginx or a virtual host.
The block it writes looks like this:
# BEGIN Shortcloud
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^go/(.*)$ apps/shortcloud/go.php?slug=$1 [END,QSA]
</IfModule>
# END Shortcloud
The block survives occ upgrade and occ maintenance:update:htaccess; if a core update replaces .htaccess, the app puts it back. From a terminal you can also use occ shortcloud:setup (with --check and --remove).
Step 4 — Tune the settings
The same settings page controls how the shortener behaves:
| Setting | Meaning |
|---|---|
| Pause | No new short links; existing ones keep working. |
| Automatic short links | One for every new public link share. |
| Path prefix | /go/ by default; changing it rewrites the rule. |
| Length of random endings | 7 by default, without look-alike characters. |
| Who may create | Everyone, or only chosen groups. Administrators always may. |
| Targets | Only this Nextcloud (default), a list of hosts, or any address. Share links are always allowed. |
| Reserved endings | Names never handed out. |
| Custom short domains | Extra hosts, with an optional prefix. |
| Pretty URLs | Hides /index.php from every address (old addresses keep working). |
A sensible starting point for most self-hosters: leave Targets at Only this Nextcloud (so your domain never becomes an open redirector), keep the default prefix, and switch on Pretty URLs.
Step 5 — Share files and copy the short link
Share a file or folder by link as usual, then open the … menu of the link share in the sharing sidebar and choose Copy short link. Short link… lets you change the ending and shows the QR code — handy for printed handouts, slides or a poster at a community event.
Albums count too: public album links of the Photos and Memories apps get short links as well.
Step 6 — Give old shares their short links
Shares created before the app have no short link yet. Backfill them:
sudo -u www-data php occ shortcloud:backfill --dry-run
sudo -u www-data php occ shortcloud:backfill
You can limit the run to one user with --user uid, and always try --dry-run first.
Step 7 — Custom endings, extra domains and manual links
- Custom endings: the domain is fixed, the rest is yours — for example
/go/annual-report. - Extra short domains: for example
https://cc.link/abc1234, served by the same server. Point its DNS to the server, get a certificate, add it under Custom short domains, then add the virtual host the page shows. It does not need to be a Nextcloud trusted domain: only the redirector answers there. - Any address can be shortened from the Shortcloud page (top menu), within the policy you set. The page lists your links with visits and last visit, and lets you pause or delete a link.
- From the terminal:
occ shortcloud:add <url> --user uid [--slug name],occ shortcloud:list,occ shortcloud:delete <id|slug>. There is also an OCS API for scripts.
Tips and troubleshooting
- Short links give "404 Not Found". The rewrite rule is not active. The settings page and Administration settings → Overview say so. On Apache check
mod_rewriteandAllowOverride All; on nginx add the snippet from the settings page. - The rule disappeared after a Nextcloud update. It is restored on the next app update, on the first request after the version change, or by the daily check;
occ shortcloud:setuprestores it at once. - A short link answers "gone". Its share was deleted or has expired — the app answers 410 Gone instead of redirecting to something that no longer exists. That is the intended behavior, not a bug.
- "Short links to this site are not allowed" when shortening an address: external targets are refused by default. Allow the host (or any address) under Targets.
- "Short links to this address are blocked" for an allowed host: the address is on the anti-abuse list. The app has no built-in list; the license server can deliver a signed list of hosts and URL fragments known to be used for phishing or malware, which applies on top of your own policy. It is empty by default — link shorteners such as bit.ly are not blocked, because many teams share them legitimately — and is filled only for targets that were actually abused. If an address you need is refused, write to us via the contact page.
- Privacy: per link the app stores owner, domain, ending, target, the share it belongs to, a label (the file name), status, visit count and last visit time. No visitor data is stored, so the visit counter is safe to leave on.
- Pausing: pausing a single link, or pausing creation for everyone, never breaks existing links. Disabling the app keeps every link stored; enabling it again brings them back unchanged.
- Group limits: if only some teams should create links, restrict creation to chosen groups — administrators always may.
Conclusion
A short link on your own domain is a small change with a real payoff: share URLs people trust enough to click, print and type. Shortcloud keeps the redirector on your server, makes short links automatically for new shares, backfills old ones, and stays honest when a share is gone. Install it, confirm the rewrite rule on the settings page, and the next link you share will be a lot easier to pass along. More background is in the knowledge base and the FAQ; the changelog shows what changed in each release.