0

WebAccess

The title says it all. As you can see in screenshot I can successfully access apache using hostname I tried in in different computer same result. But when i use my mobile phone it says "site can't be reached." I tried pinging it in my phone but no luck. Please can u help me whats the problem here?

10
  • Is your Android device on the same network as your Raspberry Pi and computer? Commented Oct 18, 2017 at 6:56
  • Yes Sir.. just same network Commented Oct 18, 2017 at 6:59
  • Is your phone able to access RPi via IP address? Commented Oct 18, 2017 at 7:25
  • @ArpitAgarwal yes i can access Apache using IP address but i want to access it using hostname.. Commented Oct 18, 2017 at 7:48
  • I just tried it with my phone and RPi and it is accessible. In your mobile browser type http://pisowifi in address. It does Google search if you do not put http Commented Oct 18, 2017 at 8:38

1 Answer 1

0

I guess if you have to access via hostname you have to edit your host file on android so that it can know the hostname and redirect to the IP address of Pi

Add a line in hosts file with

IP-address-of-Pi hostname(name by which you want to access pi) 

I think to edit hosts file your device should be rooted

here are few links which might help
http://www.trishtech.com/2014/08/edit-hosts-file-in-android/
https://www.theandroidportal.com/edit-modify-hosts-file-block-websites-android-root/ https://android.stackexchange.com/questions/60150/how-to-edit-etc-hosts-file

Hope it helps!

3
  • 1
    I think this is not applicable if the users phone is not rooted. my aim is to connect on Apache without using a IP address but the hostname. I checked all possibilities but i dont why i cant connect on my android even if i can see him in network Commented Oct 20, 2017 at 9:10
  • I think it's because the systems or servers on network or internet are fundamentally identified by IP address (since we cant remember IP address DNS comes into the picture so that it can redirect to the IP address mapped to the name.) When you try to connect to Pi on the phone if it says This site can’t be reached and server DNS address could not be found or ERR_NAME_NOT_RESOLVED. It most probably could be fixed by above method (editing the host file). To my knowledge, I think it could be done only if the phone is rooted because we are editing the internal files. Commented Oct 20, 2017 at 15:02
  • Not a good method.. i think, but thanks for the @Sneha Commented Oct 21, 2017 at 2:46

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.