SHL-006
Serve a shortlink API at the extensionless path networks expect
Ad networks and faucet scripts validate against the common shape, which is /api?api=TOKEN&url=. A rewrite gives you that without breaking existing integrations.
If you run the shortlink service rather than consume it, the endpoint's shape decides who can integrate with you. The de facto standard is /api?api=TOKEN&url=... with no file extension, because that is what the widely used providers serve and what everyone's validator expects.
Publishing api.php?api= instead means some networks simply refuse to accept your service as a custom provider. It is a cosmetic difference with a commercial consequence.
A rewrite rule solves it in one line and keeps the old path working, so nothing already integrated breaks.
# .htaccess — put this ABOVE any catch-all slug route, or /api is treated
# as a short code and 404s.
<IfModule mod_rewrite.c>
RewriteEngine On
# Extensionless API path. QSA keeps api=, url= and alias= intact.
RewriteRule ^api/?$ api.php [L,QSA]
# Short codes: /abc123 -> s.php?c=abc123 (must come after the rule above)
RewriteRule ^([A-Za-z0-9]{4,12})$ s.php?c=$1 [L,QSA]
</IfModule>
Using it
Add api to your reserved-slug list so nobody can register a short code that collides with the endpoint.
Build the documented URL from your own base URL setting, so the docs page shows the right host on every install.
Keep api.php reachable directly. Anything already integrated against the old path keeps working, which costs nothing.
What bites people
Rule order is the whole trick. A catch-all slug rule placed first swallows /api and the endpoint disappears.
Test the response shape against the network's validator, not just in a browser. Some check for a specific JSON field name before they will save your provider.
.htaccess is a dotfile and most zip tools skip it by default — which is how this rule goes missing from a release and nobody notices until an integration fails.