Redirect without changing URL

Hello! I’d like to know if I can redirect the users without changing the URL and how to do it.

Here’s why… I’ve develop an application running on a port of my server. Let’s assume that the site is domain.com and the port is 1234. So when the users navigate to www.domain.com:1234 they access the app.

I don’t like the port being visualized in the URL, and I would like that when they visit www.domain.com they would be redirected to www.domain.com:1234 but in the browser still display www.domain.com.

Is it possible? I’ve read that it could be done with .htaccess but I don’t know if I would just put the .htaccess file in the site’s FTP folder or I need to enable something to make it work

And also… would that be valid for inner paths? I mean that when they navigate to www.domain.com/home they actually would be at www.domain.com:1234/home

Thank you!

what you want to do is a task to be handled by a reverse proxy.

if your app runs on the same server as hestia, you can use the existing setup and put your domain under web-domains but create a custom proxy template to choose there.
this should then lead to your app.

while this potentially can also be done with mod_rewrite in proxying mode within .htaccess I wouldn’t recommend that. you’ll run into issue with rewriting headers and stuff quickly.

no need to have apache in between at all, so as said rather use nginx as it is there already and create your own proxy template.

1 Like

Thanks for your reply!

Yes the app is running in the same server as hestia. Would you please guide me on how to do it? I do not know how to configure a reverse proxy.

If you like, let’s assume the domain domain.com is under the hestia user named joe

I’d really appreciate that!

this covers some ground on how to do that in hestia: NGINX Reverse proxy for Docker app - #3 by flawlessx92

add the domain as normal web-domain. create a specific template which holds more or less only the proxy_pass directive to the port of your app in the location block and select that for the domain in the control panel

additional important about the web templates work you’ll find here: Web domains and SSL Certicates — Hestia Control Panel documentation

4 Likes

Thank yuo very much! I’ll try that!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.