0

I want to test a site that I am developing in my localhost environment on my Android device. I did set up my Android and PC and they are connected. When I open my remote devices in chrome, my Phone is connected. I can also open a normal url from the tool and it will open in my phone.

But I am not able to open a domain which I have set in my environment like this:

127.0.0.1 wptest.local

I would now like to op this URL: http://wptest.local/wordpress/ in my phone, but I get: ERR_NAME_NOT_RESOLVED.

I get an Apache notice "Object not found" when entering:

192.168.178.21/wptest.local/

so I am close I guess?

I have read through this question but can not figure out what to do: How can I access my localhost from my Android device?

I hope someone can explain me what to do to get access to my localhost domain?

Edit to clarify a bit: My PC and Android are connected by USB to the same WIFI and I am able to get to the localhost. That is, when I insert my IP4 address, it will go to the first "localhost name resolution" in my hosts file. That is now: 127.0.0.1 wptest.local

In my httpd-vhosts.conf, I have this code:

<VirtualHost *:80>
    ServerName wptest.local
    DocumentRoot C:/xampp/htdocs/wptest/public

    SetEnv APPLICATION_ENV "development"

    <Directory C:/xampp/htdocs/wptest/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

The folder for my site is: C:\xampp\htdocs\wptest\public\wordpress

In there is the index.php file.

When I enter my IPV I do get: Index of / and the wordpress folder on my phone. But I can not get any further. As soon as I choose that wordpress folder and hoping to open the index.php file in there, it resolves to: wptest.local/wordpress/ and that can not be found.

Clearly I am new to this stuff, but hope that this clarifies it a bit.

ProX
  • 297
  • 1
  • 3
  • 16
  • 2
    Well, localhost refers to the local address of the own device. Trying to access localhost from the Android device will try to access the Android device and not the computer for instance. – Johan Oct 24 '18 at 18:53
  • You'll have to use a real IP address, set up your network to allow it, and be on the same wifi. Or use a simulator where you can use the ip 10.0.2.2 to access the PC the simulator runs on – Gabe Sechan Oct 24 '18 at 19:04

1 Answers1

0

It's simple

1.just turn on your mobile hotspot

 2. connect your pc or laptop to your mobile hotspot. (connect your mobile and pc/laptop to the same router).

 3. open command prompt.
 4. type ipconfig and enter.
 5. copy your ipv4 address.
 6. replace your server address with your copied address.
 7. and run your project.
Umesh Sonawane
  • 517
  • 6
  • 17