Difference between www and public_html?

Hi all,

what is the difference between www and public_html? I have hosed my domain in a small hosting company and when i was going through all its folders i found both the folder www and public_html has the same content. but by hosting company asks me to upload all my files into public_html. Iam curious to know the difference between these two folders.

One is usually set up as an alias for the other meaning that it doesn’t matter which of the two you use because they both point to the same folder. That they suggest uploading to public_html means that the folder is public_html and www is just an alias set up to point to that folder.

Felgall is right, they are basically the same thing the way that most servers are setup. I have seen some servers setup where the public_html folder would show when you go to the address http://yoursite.com and the www folder would show when you go to www.yoursite.com but this is not the normal setup.

Cpanel have alias set to point public_html to www …both show the same files its just the mirror image this things are done for the apache config that cpanel uses …so no need to worry about this one.

Other way around - public_html is the real folder and www is the alias.

Or if we want to be geeky and technical, it’s actually symbolic link (symlink). :slight_smile:

So can i upload the files in www folder too?

Yes, it will just place the files in the /public_html folder.

There are some programs that expect the folder to be public_html and some that expect www so by giving the one folder both names they make sure that the programs will work whichever of the two names that the program expects.

Yes thats right, you can upload to either www or public_html, both will hold your wesbites files which you upload. www is just a linked folder over public_html.

Thanks for all you replies.

what was purpose of creating these 2 folders?
means one could have done…
in windows we have www only…
any specific technical reason…
or can i delete www folder…
or
will deleting www delete public_html ( :lol: could not test on live server)

You’re better off leaving it (It shouldn’t break anything, but there’s no telling if it would in the future and it does no harm), there is only one folder, www just happens to be a shortcut (if you want to use Windows speak) to the public_html folder - It’s to cover the bases really. Some people will be expecting www to be the folder to upload to - and it makes more sense if you’re not used to it.

Not if public_html is the real folder and www is the shortcut - but it will break whatever there is on your saite that references www instead of public_html (perhaps some of the tools in the control panel).

yes…just making things clear…

any way must of the modern script are smart enough to obtain root folder using SERVER variable…in case of php…

any way from discussion so far www seems just to make easier for people…who are mostly in to windows servers

public html seems to be the norm.

So the WWW folder doesn’t physically exist? You couldn’t have different version of the same files in WWW and public_html?

thanks did know that :slight_smile:

I have the same problem.
I have to disagree with you.
I have placed files in the www directory, because from my old server i backed it up this way.

It reads only from the public_html, so the files in the www folder will not be shown when i type www.domain.com

Also i can place different files seperately in www and public_html so they show different files. NOT SAME at all. You need to put all your files in public_html otherwise it will not work. at least not by default

-bash-3.2$ ls -lh | grep public_html
drwxr-x--- 3 mddhost nobody  4.0K Mar 12 17:57 public_html
lrwxrwxrwx 1 mddhost mddhost   11 Mar  9 15:28 www -> public_html

It’s just a symlink and the “www” folder has nothing to do with a “www.” version of your site.