rejetto forum

Two folders, two websites?

warloc · 7 · 2171

0 Members and 1 Guest are viewing this topic.

Offline warloc

  • Occasional poster
  • *
    • Posts: 3
    • View Profile
If I have two different URLs pointing at my IP, is there a way to get HFS to differentiate, and direct the different URLs to different folders?


Offline vladimirov70

  • Occasional poster
  • *
    • Posts: 30
    • View Profile
    • Honest news about a special military operation in Ukraine.
If URL is a domain name, then you can try URL redirecting at your domain name registrar. Perhaps.
Ukraine has been killing thousands civilians in Donbass for eight years. Ukraine killed 152 children and wounded 146. Russia does not start wars - it ends them.http://www.picshare.ru/uploads/220501/9d838wOcqM.jpg


Offline warloc

  • Occasional poster
  • *
    • Posts: 3
    • View Profile
I'm not sure registrars can point at specific folders?

I'll definitely check.


Offline warloc

  • Occasional poster
  • *
    • Posts: 3
    • View Profile
No, that doesn't work, they can only point at IPs, not subfolders within those IPs.

HFS really has no way to do it?


Offline dj

  • Tireless poster
  • ****
    • Posts: 291
  • 👣 🐾
    • View Profile
    • PWAs
try something like this
Properties - Diff template

Code: [Select]
[+]
<script>
if (location.href=='http://192.168.137.1/') location.href+='/Folder1'; else console.log('todo')
</script>


« Last Edit: September 14, 2021, 09:12:01 AM by dj »


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 788
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
Hi!, I'm 99.9% sure HFS is able to handle this situation, using 'HFS.events' and some macros. I did my best searching all the forum, but I could not find whether this was already discussed or not.

I will try to help you, giving a proof-of-concept idea. For example, lets say you have 'example1.dynDNS.com' and 'example2.dynDNS.com', and Folder1 and Folder2.

1) Switch to 'expert mode', pressing F5 inside HFS window.
2) Go to: Menu > IP Address > Custom... and add your domains.
3) At HFS window, press Alt+F6 to edit the 'hfs.events' file, and put the following text:

Code: [Select]
[+request]
{.if|{.match address|example1.dynDNS.com|%host%.}|
{.add header|location: /Folder1.}|
{.if|{.match address|example2.dynDNS.com|%host%.}|
{.add header|location: /Folder2.}|
{:{.disconnect.}:}
./if}

WARNING: The contents of that "hfs.events" were NOT tested by me, and that code may not work at all! (I'm just giving an idea on how it could work). That's all I can help you (my knowledge about macros is limited). I hope someone else (expert on macros), could give you a hand (meanwhile, you can read the HFS's Wiki here). / Edit: I was writing this before 'dj' posted.

Cheers,
Leo.-


Offline Rapid

  • Occasional poster
  • *
    • Posts: 48
    • View Profile
    • R&Q Portal
I would recommend to use reverse-proxy for this.
For example nginx.
It can handle any domains, folders, etc...