I have a unique situation I think, google isn't telling me much.
I want to have a way to have a hyperlink in html to simply go to: http://:8081 http://:8080
When the page itself is running on port 80.
This would usually be easy, however this is being developed as a virtual appliance to run offline on our sales teams machines, and as such the IP address will always be different dependant on the machine its running on. I also cannot use DNS for this.
Afaik, it is impossible to have a relative hyperlink to link to another port. I then thought I could perhaps just link to "./site1" and "./site2" and then use mod_rewrite to write those links to the right port.
Does anyone know how to do this? I went do it and got stuck when I realised I wanted to rewrite the URL to a static IP which I can't do! (apache or nginx rewrite rules, or any other solution very welcome!)
Use the hostname that the page requester asked for the page as, and add the port to it. With CGI it's SERVER_NAME, but the details will be dependent on what's doing the rewriting.
Thanks for the response pjz, it turns out I was a little confused with ServerName, as I thought it was dependant on DNS.
I did the following:
And that worked :-) I then set relative links in the html. I can now click the links correctly, without needing DNS or a static IP.