rejetto forum
Software => HFS ~ HTTP File Server => Topic started by: warloc on September 13, 2021, 08:16:28 AM
-
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?
-
If URL is a domain name, then you can try URL redirecting at your domain name registrar. Perhaps.
(http://images.vfl.ru/ii/1631556561/179ab78e/35852537_s.jpg) (http://vfl.ru/fotos/179ab78e35852537.html)
-
I'm not sure registrars can point at specific folders?
I'll definitely check.
-
No, that doesn't work, they can only point at IPs, not subfolders within those IPs.
HFS really has no way to do it?
-
try something like this
Properties - Diff template
[+]
<script>
if (location.href=='http://192.168.137.1/') location.href+='/Folder1'; else console.log('todo')
</script>
-
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:
[+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 (http://www.rejetto.com/wiki/)). / Edit: I was writing this before 'dj' posted.
Cheers,
Leo.-
-
I would recommend to use reverse-proxy for this.
For example nginx.
It can handle any domains, folders, etc...