Page 1 of 1

I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 02:37
by jsdanielq
Hi! please i need you to help me i've been weeks trying to fix this problem i can access to localhost from my phone and everything is perfect but when i click my folder wordpress it doesn't work and i don't know what is happening.

Image Image

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 10:16
by Altrea
We need the contents of your Apache access.log and error.log of the time around the error occurs.

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 13:14
by jsdanielq
access.log said : "http://192.168.1.44:8080/dashboard/" "Mozilla/5.0 (Linux; Android 9; moto g(6)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36"

when i try to enter in tho the wordpress folder it doesn't sent any error on the logs.

the last content in errors.log is : [Sat Jul 27 13:57:37.079162 2019] [php7:warn] [pid 9308:tid 1900] [client ::1:53268] PHP Warning: preg_match_all(): Compilation failed: invalid range in character class at offset 11 in C:\\xampp\\htdocs\\jq\\wp-content\\plugins\\js_composer\\include\\autoload\\hook-vc-grid.php on line 163, referer: http://localhost:8080/jq/wp-admin/nav-menus.php

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 15:06
by Nobbie
Forget about that preg_match warning, as it is only a warning.

The problem is that you installed WordPress to "localhost" (and applied "localhost" in the setup as hostname). WordPress does a redirect to the hostname for each document, but when you access WordPress via 192.168.39, then WordPress also does a redirect to "localhost", but in that context, "localhost" is your smartphone (and not the Xampp server). Therefore the request fails.

If you want to access WordPress from another PC or a smartphone, you MUST NOT apply "localhost" as hostname, instead you should apply the IP 192.168.39 at installation time. Maybe you can fix this error in wp-config.php, edit the file and replace the hostname (or servername or server URL or whatever, i dont know WordPress well and this is NOT a WordPress forum!) from "localhost" to "192.168.39". If in doubt, ask in a WordPress forum how to apply another servername AFTER installation.

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 18:01
by jsdanielq
Nobbie wrote:Forget about that preg_match warning, as it is only a warning.

The problem is that you installed WordPress to "localhost" (and applied "localhost" in the setup as hostname). WordPress does a redirect to the hostname for each document, but when you access WordPress via 192.168.39, then WordPress also does a redirect to "localhost", but in that context, "localhost" is your smartphone (and not the Xampp server). Therefore the request fails.

If you want to access WordPress from another PC or a smartphone, you MUST NOT apply "localhost" as hostname, instead you should apply the IP 192.168.39 at installation time. Maybe you can fix this error in wp-config.php, edit the file and replace the hostname (or servername or server URL or whatever, i dont know WordPress well and this is NOT a WordPress forum!) from "localhost" to "192.168.39". If in doubt, ask in a WordPress forum how to apply another servername AFTER installation.



I already change my servername to my Ip, but i can't still access.

my question is not about wordpress, it's why can i access to my localhost root page but not to the wordpress folder?

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 18:06
by jsdanielq
Don't worry i found a tutorial how teach me how to fix the problem! thankyou!

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 18:48
by Altrea
So what was the problem and how did you solve it?

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 19:04
by Nobbie
jsdanielq wrote:my question is not about wordpress, it's why can i access to my localhost root page but not to the wordpress folder?


Very funny, indead.

You can access localhost (which means, you can access Xampp), but you cannot access WordPress?! But your problem is still NOT about WordPress? Whatelse?? Joomla? Chess? Football?

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 20:13
by jsdanielq
I try a lot of thing, i don't know exactly winchone worked

1- in xamp control panel - i changed my apache serverport to 8080
2- in httpd.conf - change the servername to mi ip 192.x.x.x.:8080
3- add this code to htppd-xamp.conf:
#
# New XAMPP security concept
#

# Close XAMPP security section here
<LocationMatch “^/(?i:(?:security))”>
Order deny,allow
#Deny from all
#Allow from ::1 127.0.0.0/8
Allow from all
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>

# Close XAMPP sites here
<LocationMatch “^/(?i:(?:xampp|licenses|phpmyadmin|webalizer|server-status|server-info))”>
Order deny,allow
#Deny from all
#Allow from ::1 127.0.0.0/8
Allow from all
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>

4- in phpmyadmin DDBB on table wp_options:
- in siteurl: change from localhost to 192.168.x.x/namefolder
-in home: change from localhost to 192.168.x.x/namefolder

5- in system32/drivers/etc/host
- add after the last line: # 192.168.x.x(your ip) apacheserver

then i empty cache and some of those step make it works

Re: I cant acces to localhost/wordpress from my phone

PostPosted: 27. July 2019 20:43
by Altrea
It was step 4 which solved your issue. That's exactly what matches your explanation. By the way that is what Nobbie told you too, a WordPress configuration issue.

I would not recommend to follow any of the other steps. They lower your xampp security level and are relying on old configuration settings xampp didn't use any more.