PDA

View Full Version : Where do I place images for Web Pages?



Stephannie
11-11-2007, 04:46 PM
Hello,

I have created a 21 page website.

Each page ends with .html

Where do I place the images files for the pages I have created?

in the publichtml folder? And create new folders for each page or just place in the public html folder?

What about the images that go into the web pages where do I place those? public html? wizard images???? Please help.

1 more question:

Why when I want to view my site, I have to type /About.html example after the domain name? Can't I just type www.-----.net? (------) domain name

Do I have to redirect or save the site pages different?

Do I place the images in each separate folder in my computer or just all of them in on folder?

Thank you for your help.

sidorak95
11-11-2007, 05:55 PM
Is it your real domain or your subdomain?
On your mainpage, just upload to the public_html folder.
On a subdomain, upload to that folder. (Example: public_html/images)

Stephannie
11-11-2007, 06:00 PM
What would be a subdomain.

www.heatup.net/aboutus.html?

Is it all the other pages to the site except the index home page?

Thank you

sidorak95
11-11-2007, 06:04 PM
A subdomain is a domain that does NOT have a .html end over it.
(Example: http://www.fungamesuniverse.com/gamespage1/ (http://www.fungamesuniverse.com/gamespage1/)

linFox
11-11-2007, 06:33 PM
A subdomain is a domain that does NOT have a .html end over it.
(Example: http://www.fungamesuniverse.com/gamespage1/ (http://www.fungamesuniverse.com/gamespage1/)

A subdomain is a secondary-level domain on top of your top-level domain (ie. http://sub.domain.com)
What you are talking about there is simply a subfolder.

Regarding the original question, for a normal root domain, you can put the images (and all of your sites' content) anywhere within public_html, because public_html is the root of your website. You just have to use the right path when linking to them. For example, if you put all your images in a folder under public_html called 'images', the correct way to link to them is:
<img src="/images/image.jpg" alt="" />
If you put your images in root public_html, it is simply
<img src="/image.jpg" alt="" />

With your other question, to do this, you should rename your index page (that page that you want displayed when you just use the domain name with no file on the end) 'index.html' or 'index.htm'.

shadmego
11-11-2007, 06:52 PM
...

Regarding the original question, for a normal root domain, you can put the images (and all of your sites' content) anywhere within public_html, because public_html is the root of your website. You just have to use the right path when linking to them. For example, if you put all your images in a folder under public_html called 'images', the correct way to link to them is:
<img src="/images/image.jpg" alt="" />
If you put your images in root public_html, it is simply
<img src="/image.jpg" alt="" />

...
This is not entirely true. If you place the "/" in front of the images directory in your example, the webpage try to interpret the link as an absolute link. In other words, the page will try to look in the following location for the image:

/images/image.jpg

Instead of where the actual location is:

/home/accountname/public_html/images/image.jpg

It seems to be a confusing thing to explain the difference between absolute and relative links, but an easy way to think about it is this:

An absolute link is a link that is relative to the OPERATING SYSTEM root directory. They will always start with a "/" in Linux systems or "C:\" in Windows systems, if C is the drive letter.

A relative link, which is most common to websites, is a link that is relative to the LOCATION OF THE SCRIPT INTERPRETING THE LINK. These links will NOT start with a "/", but instead, they will start with either a simple folder name or "..", which means (go up one directory).

So using the example you gave above, the correct link would be

<img src="images/image.jpg" alt="" />
If you put your images in root public_html, it is simply
<img src="image.jpg" alt="" />

Hope that helps,

~regards

FargoBJJ
11-15-2007, 04:48 PM
how long till your site is up from when you upload it ?

sidorak95
11-15-2007, 05:10 PM
When I upload it and open my site, the new site is already there.

r2b2
11-15-2007, 05:35 PM
An absolute link is a link that is relative to the OPERATING SYSTEM root directory. They will always start with a "/" in Linux systems or "C:\" in Windows systems, if C is the drive letter.

A relative link, which is most common to websites, is a link that is relative to the LOCATION OF THE SCRIPT INTERPRETING THE LINK. These links will NOT start with a "/", but instead, they will start with either a simple folder name or "..", which means (go up one directory).

So using the example you gave above, the correct link would be

<img src="images/image.jpg" alt="" />
If you put your images in root public_html, it is simply
<img src="image.jpg" alt="" />


Just to clarify this post, absolute links (in the HTTP world) actually start from the Web Server's Document Root. With your primary account, this would be /home/yourusername/public_html - with add-on domains, this would be the directory where you've stuck it (e.g. /home/yourusername/public_html/myaddondomain.com/)

Assuming that the the index.html file is in your public_html directory (i.e. the document root) and there is an images folder under that which contains the image, <img src="images/image.jpg" alt="" /> and <img src="/images/image.jpg" alt="" /> will actually be the same thing.

This has probably confused things even more but just thought I'd make sure it was out there... :D