• The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Question Dynamic domain redirection with CNAME - Linktree-like service (Plesk Obsidian on Debian VPS)

Pecnet

Basic Pleskian
Server operating system version
debian
Plesk version and microupdate number
18.0.66
Hello,

I'm running Plesk Obsidian on a Debian VPS.

I have a Linktree-like service hosted on my Plesk server.
My main site is example.com where my clients have their profile page accessible via example.com/hub/clientname/

I want to allow my clients to use their own domain with a 'link' subdomain.
For example, if my client owns client1.com, they set up a CNAME:
link.client1.com → example.com

When a visitor accesses link.client1.com, I want them to be automatically redirected to example.com/hub/client1/

The DNS works correctly (CNAMEs point to my server), but I can't configure the automatic redirection to transform:
link.client1.com → example.com/hub/client1/
link.client2.com → example.com/hub/client2/
etc.

I've tried:
1. Nginx configuration via additional directives
2. Domain aliases in Plesk (but no wildcard possible)
3. PHP redirection

How can I configure this dynamic redirection on my Plesk server?

Thank you in advance!
Have a great day.

Feel free to ask if you need any additional information.
 
Hi,

I'll try this

if ($host ~* "^link\.([^.]+)\.") {
return 301 https://example.com/hub/$1/;
}

here ->

sudo nano /var/www/vhosts/system/example.com/conf/vhost_nginx.conf

but without success
it does not create the redirection

I also try like here on apache ->

# VirtualHost for link.client1.com
<VirtualHost *:80>
ServerName link.client1.com
Redirect 301 / https://example.com/hub/client1/
</VirtualHost>

# VirtualHost for link.client2.com
<VirtualHost *:80>
ServerName link.client2.com
Redirect 301 / https://example.com/hub/client2/
</VirtualHost>

# VirtualHost for link.client3.com
<VirtualHost *:80>
ServerName link.client3.com
Redirect 301 / https://example.com/hub/client3/
</VirtualHost>

it doesn't work either :(
 
Looks like you're pretty close to achieving your objective.

First thing I like to point out is that any domain a customer points to your Plesk server needs to be added to the Plesk too. Otherwise the server won't be able to resolve any requests for it. Depending on your setup adding those domains as aliases might be the easiest choice.

Secondly, after adding any directives to /var/www/vhosts/system/example.com/conf/vhost_nginx.conf you'll need to reload Ngnix, with service nginx reload.
 
Thanks for your answer
with your help I think we're making progress :)

i managed to add the alias
the alias points

link.client1.com
sending to
example.com

but not yet on ->

example.com/hub/client1/

sudo nano /var/www/vhosts/system/example.com/conf/vhost_nginx.conf

i think my ngix directive is not good
could you however check if it's ok or not?

i tried this


if ($host ~* "^link\.([^.]+)\.") {
return 301 https://example.com/hub/$1/;
}

but it doesn't give anything after

sudo nginx -t
sudo systemctl reload nginx

or

sudo service nginx reload

how should i write for the directive (ngix)?
if we do the directives can i delete what i wrote for the apache directives area?
thanks
 
Good evening,

I think that plesk does not correspond to this task and the rest like reverse proxy etc....

(maybe by configuring more I could have but I think that I was going to modify too many files and wanted to stay on a default base on plesk)

I also wanted the url to be stable and no redirection

example: link.client1.com and no final redirection to the page -> example.com/hub/client1/

but keep link.client1.com

On plesk I have my project with the different pages
for the rest I use cloudflare for advanced configurations

thanks again
 
In case you don't want any redirects, there isn't much you'll need to configure in Plesk. Just add those custom domains from your clients as an alias and let your Linktree-like application handle the rest.
 
I tried that but the cname on the client side and the alias on the plesk side sent me back to example.com to see the home page of my platform and not on the profile page.

I tried via ngix, htacces, or php redirects it didn't work

but as I said even if it worked it wasn't the right action because I have to make a reverse proxy and on plesk it seems to me that I have to set a lot of points

finally I have between () subcontract this technical part on cloudflare
 
Back
Top