I
I
Irina2021-07-18 01:01:34
Windows
Irina, 2021-07-18 01:01:34

Redirect from 192.168.1.25:8000 to localhost, how to do?

I launched a local server in Win10 on python in the directory of the page of my self-written interface according to this instruction .
Ok, at 127.0.0.1:8000/1.html the page opens.
Registered in hosts 127.0.0.1 myweb.com
Ok, the page opens on myweb.com:8000/1.html .
Registered in hosts 127.0.0.1 192.168.1.25
And fsyo... Nothing opens on 192.168.1.25:8000/1.html .
So, how do I redirect from 192.168.1.25 to my page? ..

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasily Bannikov, 2021-07-18
@vabka

The hosts file is for matching domain names, not ip addresses.
In order for the site to open on 192.168.1.25, you must have the following:
1. The web server must listen for requests at this address
2. Your computer running the web server must have this address.

A
Artem @Jump, 2021-07-18
curated by the

Redirect from 192.168.1.25:8000 to localhost, how to do?
No way. You seem to be confusing warm with soft.
Forwarding is moving from address to address.
The address is 192.168.1.25, you can redirect from this address to another - for example, to 25.31.1.124.
But what side is the port and domain name here - it is absolutely incomprehensible.
Registered in hosts 127.0.0.1 192.168.1.25

hosts stores the correspondence of a domain name to a specific address.
The system, if it does not know what address, finds the name in this file and looks at the address.
Any entry in this file is done in the format address name.
Is 192.168.1.25 a domain name? It's kind of wrong with you. After the dot, it is not clear what is indicated, and there are somehow a lot of dots.
So, how do I redirect from 192.168.1.25 to my page? ..
Yes, redirection is elementary. Just tell me the address of your page.
Better yet, explain what you mean by redirection, and what you want to achieve in the end.

D
Dinxor, 2021-07-18
@Dinxor

If 192.168.1.25 is the address of your computer, then you do not need to edit hosts, you need to start the server at 0.0.0.0, this will also allow you to access it from other devices on the network. Try
python -m http.server 8000 --bind 0.0.0.0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question