thedevs-network / kutt

Free Modern URL Shortener.
https://kutt.it
MIT License
8.4k stars 1.09k forks source link

Feature request: custom shortener domains without a 3rd party #583

Closed shruuub closed 1 year ago

shruuub commented 2 years ago

Hello, could you please allow to used custom short domains to be setup by a admin, without using a 3rd party (when using the normal add domain feature, for some reason rebrand.ly is used).

Edit:/Plus, how does the SITE_NAME var work? It doesnt display anything for me.

SamGreenwood1 commented 2 years ago

You could just self host it.

shruuub commented 2 years ago

You could just self host it.

Please read my message correctly. I selfhost kutt, but when i add a custom domain, rebrandly is used, with no config option to change this

TyraVex commented 1 year ago

Here's a solution :

server {
    listen 80;
    server_name <custom domain>;

    # Redirect requests without arguments to a default page
    if ($request_uri = '/') {
        return 302 $scheme://<default domain redirect>$request_uri;
    }

    # Redirect requests with arguments
    if ($request_uri != '/') {
        rewrite ^/(.*)$ $scheme://<self hosted kutt domain>/$1 permanent;
    }
}

Note : this may be not what you want. This is linking the default domain to the custom domain, sharing the same redirection. This is useful if you want your kutt instance to run in a different domain than the one you want to use for redirections.

shruuub commented 1 year ago

Damn, has been so long that I even stopped using kutt. However, yes, that seems to be a pretty good workaround, thanks a lot!