Making mywebsite folder structure work in Xammp [Solved]

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Making mywebsite folder structure work in Xammp [Solved]

Postby old_guy » 29. October 2012 15:13

Hi all,
I am using Win XP and Xammp v1.8.1

Newbie question - so hopefully a simple answer

I have 3 hosted sites and use a common structure for each. This is:-

root\ - On my hosted site this is \public_html\
root\images\ - On my hosted site this is \public_html\images\
root\css\ - On my hosted site this is \public_html\css\
root\upload\ - On my hosted site this is \public_html\upload\

In each of these hosted sites I keep all the graphics in the relevant images folder.

I have copied the files from the hosted sites to a named folder in C:\xampp\htdocs\ for example:-
C:\xampp\htdocs\site1\
C:\xampp\htdocs\site2\
C:\xampp\htdocs\site3\

The index page - pointing through my browser using:- http://localhost/site1/index.php works but the images are not displayed, only the alt links. This is the same using site2 and site3 in the url.

So the question:-
How do I get the images to display correctly using localhost without changing any of the code that works on the hosted sites and keeping the folder structure complete?

This has probably been asked lots of times but I cannot find a solution via search that I can understand.

Any help would be greatly appreciated
old_guy
 
Posts: 2
Joined: 29. October 2012 14:00
Operating System: Win XP

Re: Making mywebsite folder structure work in Xammp

Postby Altrea » 29. October 2012 18:34

Hi old_guy,

old_guy wrote:So the question:-
How do I get the images to display correctly using localhost without changing any of the code that works on the hosted sites and keeping the folder structure complete?

That fully depends on how you reference them in your code and in which folder Apache now expected the images to be.
So please take a look into your \xampp\apache\logs\error.log and \xampp\apache\logs\access.log for the needed informations.

I for example structure my testing environment something like that way:
Code: Select all
htdocs\
  - url1.com\
    - (some files saved above document_root)
    - public_html\ (which has a VHost with DocumentRoot for url1.com)
  -url2.com\
    - (some files above document_root)
    - public_html\ (which has a VHost with DocumentRoot for url2.com)
etc.


best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Making mywebsite folder structure work in Xammp

Postby old_guy » 30. October 2012 13:44

Hi,

Thanks for the fast reply. While it was not the "hand-holding-do-it-for-me-post" that lazy people like me want, it was great because it taught me something.

The clue was the reference to vhost. An internet search for "xampp virtual host setup" brought up loads of pages (198,000) and I followed this one as I could understand it (I am a little slow ):-

http://sawmac.com/xampp/virtualhosts/

The Client A and Client B were the give away and by using the .local at the end of the client name in the hosts file made it simple to follow (For me any way.)

So with a fast reply and a little cut and paste from the above page everything is now working on the image and css front.

So again - Thank you - and I look forward to presenting my next set of problems to the board.
old_guy
 
Posts: 2
Joined: 29. October 2012 14:00
Operating System: Win XP


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 57 guests