简体   繁体   中英

How to access shared hosting website by ip address

I just start learn to create website. I create a free shared hosting (Hostinger) and uploaded my website. I can access my site by domain name but i dont known how to do it with the ip address they gave me.

> -My Domain name: mywebsitename.esy.es
> -IP: 31.170.167.204
> -Username: u935348985
> -SERVER IP: 31.170.167.195

Here is the question again: How can i access my web by the ip they gave me, not by domain name? THANK.

If you're using shared hosting, making a HTTP request to the IP alone is not enough, as the server does not know which site you're looking for. Alongside the request, you must include the Host header, with your domain included.

By default, a browser will do this from the URL you provide it - so it will obviously be empty if accessing by an IP address. Depending on your browser, you can use various extensions to manually set the headers as required.

There is a way to access your website with a testing URL. Use the below site and enter your server and domain details there.

https://hosts.cx/

This will create a temporary URL.

Generally you can access in shared hosting website using IP or DNS address by you have to add ~ sign before your username in below format

http://<server_ip_or_dns>/~<your_username> ,

If its not working then you have to contact your web administrator.

As mentioned by @Gareth, you can use a software like PostMan to simulate a request to your host. Just use a GET request with your server's IP address, then:

  • Click on Headers
  • Uncheck Host header
  • Add a new Host header and specify your domain name as value
  • Then Send your request

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM