Page 1 of 1

Images Are Missing

PostPosted: 10. October 2010 02:20
by MyWorld
I downloaded a copy of my site to the htdocs folder, everthing works fine except I can't see the images. The images on the live site uses a relative path so I assume that's why this is happening. On my local server it's looking for the images using this path: http://127.0.0.1/images/myimage.gif but the correct path on my local server is http://127.0.0.1/mysite/images/myimage.gif

Is there something I can do to fix this so that when I upload the site I don't have to change all the paths again.

Thank you!!

Re: Images Are Missing

PostPosted: 10. October 2010 02:35
by JonB
Other than the obvious "create that folder and copy the files over there", there are some more exotic things you could do.

Alias is the 'correct' Apache solution I suppose:

http://httpd.apache.org/docs/current/mod/mod_alias.html

read down a bit to the Alias Directive part.

you would put your Alias directive in the \apache\conf\httpd.conf file in teh <IfModule alais_module> section. Thye give an almost dead-on example.


Good Luck
8)

Re: Images Are Missing

PostPosted: 12. October 2010 22:27
by MyWorld
Sorry I have no idea what I should be doing. I assume I need to add this line "Alias /image /ftp/pub/image" in the <IfModule alias_module> below?

Code: Select all
<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://localhost/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.
   Alias /image /ftp/pub/image

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/"

</IfModule>

Re: Images Are Missing

PostPosted: 12. October 2010 22:42
by Nobbie
MyWorld wrote:I assume I need to add this line "Alias /image /ftp/pub/image" in the <IfModule alias_module> below?


I dont think that this works correctly. Or, does it?

Re: Images Are Missing

PostPosted: 12. October 2010 22:51
by MyWorld
No it doesn't work. :(

Re: Images Are Missing

PostPosted: 13. October 2010 00:23
by JonB
It doesn't work because your images aren't in "/ftp/pub/image"

in living color - here is a working example:

Code: Select all
   # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.
   Alias /aliased-images/ "C:/xampp/htdocs/images-2/"
    #

three URLS:
http://bravo.newnetenterprises.com/design-tests/ (where innoDB-2.png is embedded in a page with its true URL - get its properties - its in images-2)
http://bravo.newnetenterprises.com/alia ... noDB-2.png
and finally all by tiself:
http://bravo.newnetenterprises.com/imag ... noDB-2.png

C'est bon. no? :D

Re: Images Are Missing

PostPosted: 13. October 2010 14:05
by MyWorld
OK please bear with me but this still isn't working. I'm probably totally misunderstanding what you are trying to tell me. I tried the following:

Alias /aliased-images/ "C:/xampp/htdocs/mbc/"
Alias /aliased-images/ "C:/xampp/htdocs/"
Alias /images/ "C:/xampp/htdocs/mbc/"
Alias /images/ "C:/xampp/htdocs/"

"mbc" is one of the folders that I have in the htdocs so I add it to the path to see if that would work. I'm hoping to have it work so that any website folder that gets added to the htdocs the images will automatically show.

Thanks!!

Re: Images Are Missing

PostPosted: 13. October 2010 14:53
by JonB
1st - where is the folder 'mysite' on your local server? (and WHY is there a 'mysite' folder? - MAYBE that should be your DocuemntRoot)

give the whole path -

IF it is under c:\xampp\htdocs, the alias would be

Alias /images/ "C:/xampp/htdocs/mysite/images/"

Be aware - you CAN'T have both a 'real' and an aliased object with the same name.

so you can't have an alias for "images" in htdocs and a real folder with the same name - that would break the fully qualified URI rules - each resource must have a uniquely identifiable address. There can be two of 'you', right? too confusing... the same for URL's

Alias simply means 'another name for'.

As I pointed out in my first post, you also could probably create a folder called images and move all the files there. If there is already a folder with that name, just copy the needed files into it.

I hope this is helpful
:shock:

Re: Images Are Missing

PostPosted: 30. October 2010 07:46
by JenifferMilers
The thing is that the images don't display if the connection is http. Therefore, whenever I open a new spreadsheet (conveniently in http format)

Re: Images Are Missing

PostPosted: 30. June 2011 21:23
by boskom
That is not necessarily true, and I will prove it for you!!

Re: Images Are Missing

PostPosted: 01. July 2011 01:17
by JonB
wow - a spammer to spammer argument evolves over time...

:shock: