Link to home
Start Free TrialLog in
Avatar of mrwarejr
mrwarejrFlag for United States of America

asked on

Images not showing in WordPress

Does anyone out here know Wordpress?  Here is the issue I am running into.

We have a site on a production server that works fine. You go to the home page and the images, ads, and facebook links are showing up perfectly. I am setting the site up on my local machine to test changes to the site. After I backup the DB I replace all http://www.domain.com with localhost. Once I do that the images do not show on my machine. If I restore the DB with the original URL the images show up, but obviously all my tabs and links direct me to production.

Please let me know if any one has any ideas on what the issue may be.
ASKER CERTIFIED SOLUTION
Avatar of TravisT
TravisT

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrwarejr

ASKER

The images are physically on the machine.  When I use localhost the images do not show.  If I change the DB to www.domain.com/imagepath the files showup.  I can not figure out why they do not show when localhost is selected.
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TravisT
TravisT

Agreed....use the IP then....if they are using host headers, locahost will not work, for that matter, neither will the IP....you will need to use relative paths in order to make it work.
I just tried to use the IP address and it did not work either.  What would you suggest next.
Then they are using host-headers.

Test with one image and use a relative path as I put in my example above.

Travis
I have Wordpress 3 working on XP and it's using the machine name.
Ohhh....Xp....yeah...relative paths shoudl work then.
It's running on IIS5.1 with PHP 5.2.5 and MySQL 5.0.51 by the way.
Try with one image the relative path and report back.
When I 'View Source', Wordpress is taking the 'siteurl' from the database and prefixing all links with it.  'siteurl' is the server path to the directory with 'index.php'.  On my machine it is "http://dibsnxp667/Wordpress" with no trailing slash.
I will try and report back
hmmmm......usually using a relative path permits this form happening.
My Wordpress blog on Linux hosting does the same thing, it prefixes all links with it 'siteurl'.
Okay I think we have narrowed it down using Beyond Compare on a working and not working sql file.  This image shows the only difference between the 2.  Anyone have any ideas on this.
Widget-Issue.jpg
I can't see any difference in the part that is visible.
Sorry the only difference is the working one has http://www.domain.com and the non working one has http://localhost 
As far as I know, I don't have a 'widget' on either of my Wordpress installations.  But as I mentioned above, all the links on my pages show the 'siteurl' prefixed to the urls for everything else.  'siteurl' is the first record in the 'options' table of the Wordpress database.  If you look at the "View Source" on your hosted version, you can see what I'm talking about.  If that record is different than 'siteurl', you probably need to make it match.
OK - do this for testing purposes.

Go to c:\windows\system32\drivers\etc\hosts

Add a line in that says this (where 12.34.56.78 = your IP address and www.domainname.com = the domainname you will be using):

12.34.56.78  www.domainname.com


Keep in mind this make your machine now think you are the server hosting this domain - to disable this after testing or when youa re ready to upload, put a # back in front of the line to comment it out.
What is working?  If the server for your external links are aware of the referring server, they may not work when they're not on the publicly available server.  I know that Google puts up funny ads in 'foreign' languages when I'm working on those pages on my own local server.
Sorry for the delay.  I have been out sick from work.  Well this issue never got resolved and we have dropped the project so I will just spread out the points to all of you for your help.