I’m trying to make access to my MAMP localhost from my mobile phone and other Windows PC. I’m currently using a Mac.
While I can see the database content but the website doesn’t render as usual (no images, stylesheet, etc…).
Therefore I assume the other PC can access the database but can’t use the files. Maybe the PHP files are not processed?
Does anyone have a suggestion on what could be the cause and how to fix it?
However I can see the database content but the website doesn't render
as usual (no images, stylesheet, etc)
Does your site on the MAMP install use hardcoded URLs for CSS, images & JavaScript? Something like this:
http://localhost/images/a_great_image.png
If so, when a remote host accesses your site, they will not be able to see the content on URLs like that since they will be pointing to localhost and localhost is an address directly connected to the local machine. Meaning that any machine will only see localhost as their actual machine; never a remote machine. It’s a loopback hostname for testing & restricted local access.
The two solutions you have is to do the following:
Change the localhost address to be the IP address of your computer on the network. So if your computer is reached via the IP 10.0.1.3, then the URL would be: http://10.0.1.3/images/a_great_image.png.
Change the URLs to be relative URLs such as /images/a_great_image.png and maybe use base tag like this <base href="http://10.0.1.3/" target="_blank"> on each page. That way all your links in URLs are relative, but the base is set once & is always http://10.0.1.3/.
Related
I'am new to the WordPress and I created WordPress website and configure it within the Wamp Server. The site displays all it's contains locally correctly. Now I want to access that website from the another machine within same network but it did not display all the contents correctly. it displays only the text. no images and the applied theme is not displays. I turn off the firewall and change the Apache configuration file (httpd.config) as follows. but it also didn't work properly. please help me.
Order allow, deny
Allow from all
The problem is that you specify during install that the hostname of the site is "localhost". Unofrtunately when you connect from another computer the link to "localhost" refers to the pc you are connecting from and since in this pc there isn't any server runnin,g you see only the text and not the images or the css.
The solution is to modify the wp-config.php wordpress file and change this from:
define('DB_HOST', 'localhost');
to:
define('DB_HOST', '192.168.0.4');
The problem is with URL of the site. You need to update the URL in database and replace localhost with IP of your machine using phpmyadmin and then that site will be accessible from other machines in your network. Please try this and it will solve your problem.
This is a WordPress oddity. When you install WP on localhost, or anywhere, it stores the url used in the install in its database. It then uses this url internally in its code to build links etc.
So when you come to run this site from another PC, things like image links will be built with the url localhost or localhost/wordpress.
Now when you run this from another PC using a different URL like 192.168.0.4/wordpress localhost will still appear in the links and of course there is no localhost on the client PC. So the links dont work. Its a bit like you have moved your site to a new url, but WP does not know about it.
Read this post on the WP Codex to work out what you need to so to amend the urls in the database. OF course this means you wont be able to use localhost anymore on the WAMPServer machine either.
I am using my laptop as a test environment for a wordpress website before I move it to an online server. I have this setup with a xampp sever running on the local machine. Wordpress is installed and running a theme which I have modified somewhat. When I navigate to the website from the local machine by going to 'localhost', the website displays correctly, however if I navigate to the website from another device whether it may be a computer, phone or tablet, the website seems to exclude css styling and only displays plain html. Any insights would be appreciated.
I know that with some browsers, sites in your local intranet except localhost are rendered differently. I am not sure whether this is the issue here. I am using Chrome Version 42.0.2311.135 dev-m
When you're accessing the site on another machine, open up the developer tools in your browser and see where the link to your CSS is pointing at.
It sounds like that CSS URL is hard-coded to be pointing at localhost (which would explain why it only works on your machine). It could also be the case that you have set your site's domain to be localhost in Wordpress which may be using that to render the URLs.
Double check your Wordpress settings, and also your theme's code.
I am working on a invoice report with my companies intranet. I would like to be able to link the invoice number to the actual invoice. My problem is that the file resides on a different server and not the web server.
When I'm on the computer I have to use the remote desktop connection to access the server to get to the files.
I've tried \SERVER\file_path.pdf and file:\\SERVER\file_path.pdf and neither works.
What you are doing is disabled by design. This sort of link to a local file will work in some browsers as long as the HTML is also called from a local file (ie file:///pageContainingLink). If not, it's a security vulnerability. It won't work at all in webkit based browsers.
See <A>nchor Link to Local File? (<a href='file:///{path}'>DEAD LINK</a> not working in FireFox but in IE)
And Cross-browser link to file on local system
If you want to get this to work, you'll need the other server to be a web-server too so that you can link to http://intranet2/fileYouWant.pdf
Try creating a symbolic link from the network share \SERVER\ to your machine --> X:\pathtoyourapacheroot\distantdocuments on your server machine
Then you should be able to use it just has if your file was on your machine x:\pathtoyourapacheroot\distantdocuments\file_path.pdf.
I have installed wordpress on my IIS server using web plaform intaller, everything is working fine when i am working on localhost.
when when i am trying to browse from external or another pc, the links are stayed http://localhost/page.php, which should be http://myserver/page.php
even the styling is not applied because of that.
how do I change the Path and make it work??
Thanks
You will have saved in the database that your site url was http://localhost. To access it from everywhere, I'd use your IP address instead, that way you should be able to see it on your local and external machines.
Do a quick export of your db, open in a text editor.
Find/ replace 'localhost' and change it to whatever your computer's IP is.
Import your changed sql file. Should be all good :)
Let me introduce to the situation we had to face it and the core of the question.
We needed in our project to change the "localhost" to be something else like "newdomain-localhost.com", so we changed the hosts file (in Windows) and everything worked.
We reached the wall of Facebook with its sharer, where you need to get the site into a whitelist if you want to share content like flash. It's allright with the production server, but what happens in the dev enviroment?
My question is: if I change the hosts file to get localhost into something like "newdomain-localhost.com", when a request is thrown from my local machine to a service like Facebook, Facebook will take the domain "newdomain-localhost.com" or directly the public IP of my machine (which in this case is fixed, but it can be dynamic)?
Let me add that I think it perfectly makes sense to say that the hosts is something that affects locally, and the service receives the public IP instead of the domain name.
Correct?
I'm not certain I grasp your question, but my best guess is it boils down to:
If I rename localhost to newdomain.example.com within the hosts file do external sites see that?
And the answer is catagorically: no
Your hosts file is simply used by your local machine to resolve addresses - it is not visible to anyone/anything outside of your local machine. Now if you put that data within a public DNS it would be a different story - but I won't complicate things by going off on that tangent * admires tangent *
What happens is the following: if you add/change something to your hosts file (/etc/hosts on linux, %windir%\system32\drivers\etc\hosts on windows), only your local PC will act differently because it first looks in this hosts file when it tries to find an ip-address for a host name. The host name will be sent with the HTTP request, so web servers can act differently for different host names with the same ip-address.
You might be interested in reading a bit about network address resolving (e.g. http://en.wikipedia.org/wiki/Domain_Name_System )
What exactly is your project doing? Are you talking about Facebook connect? What you are saying will work fine on your computer for Facebook connect, but only on the computers where you've modified the hosts file.
If you have Facebook connect set so your application goes to http://www.production.com, then you just need to add a line to your hosts file saying www.production.com is 127.0.0.1. When you click on the connect button the login window opens and that redirects you to the url http://www.production.com to set your connect cookies. Since your computer thinks that the IP for that site is 127.0.0.1 and since cookies are stored with host names and not IPs that works fine.