10 Replies - 4119 Views - Last Post: 17 December 2008 - 01:48 AM

#1 kummu4help  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 245
  • Joined: 05-August 08

how to put files in other than public_html folder

Posted 16 December 2008 - 11:59 PM

Hi,
i have an account in x10hosting.com
my site url is www.eway.exofire.net

in that i have all my files in public_html folder.
so any one can see my css,js source code.

that's why i want to move some of my files to any other folder above public_html

i tried to create a folder and placed my files there.
but i am unable to access them from my index.html.

can any one help me pls....

Is This A Good Question/Topic? 0
  • +

Replies To: how to put files in other than public_html folder

#2 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5182
  • View blog
  • Posts: 26,879
  • Joined: 10-May 07

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:04 AM

View Postkummu4help, on 17 Dec, 2008 - 12:59 AM, said:

in that i have all my files in public_html folder.
so any one can see my css,js source code.

that's why i want to move some of my files to any other folder above public_html

Am I correct in guessing that you want to move these files so others can't read them, the answer is you can't. Think about it. If my browser can not read your javascript or css files, then... the browser won't function as you are designing by included the javascript & css files.

This is a situation where you just have to bite the bullet & let the world see your handy work.

Now, if I am incorrect about my assumption, then please explain in a little more detail as to what you are trying to do.
Was This Post Helpful? 0
  • +
  • -

#3 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:05 AM

You could have them in a PHP file such as:

styles.inc.php

and write your styles as CSS within the HTML... I've done this before for PHP variables to hide them from the browser, I'm not sure if this would work for CSS / Javascript though.



EDIT:

After thinking more about that, no... it wont work :P

Sorry, I was thinking about PHP variables that the server recognizes, not the client.... in this case, you NEED the client to recognize it.



ON TOPIC:

Why would it matter if people can see your Javascript / CSS? Unless you're hiding something that you don't want people to know? :)

This post has been edited by pr4y: 17 December 2008 - 12:07 AM

Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5182
  • View blog
  • Posts: 26,879
  • Joined: 10-May 07

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:08 AM

View Postpr4y, on 17 Dec, 2008 - 01:05 AM, said:

I'm not sure if this would work for CSS / Javascript though.

Javascript is processed by the browser. It must be viewable.

Take the following scenario :

Me : "Follow the instructions I have written on this sheet of paper"
You : "Let me see the paper then..."
Me : "No."
Was This Post Helpful? 0
  • +
  • -

#5 kummu4help  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 245
  • Joined: 05-August 08

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:08 AM

to some extent you r right no2pencil,

what i want to convey is,

i want to place some of my files in some other folder say, xyz.
now i want to refer them in my index.html file like
<link rel="stylesheet" type="text/css" href="../xyz/style.css" media="all">



but i am unable to do this on my site in x10hosting.com.
u can also see my site and it's source code there...

thanks for quick response
Was This Post Helpful? 0
  • +
  • -

#6 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:09 AM

Also about your website, its a bad idea to use frames. let alone frames that have width / height attributes that aren't static. Myself, I use a Firefox window that is nowhere NEAR the size of my entire screen (1680x1050)... and it forces me to resize my window.

99% of the time, if I have to resize my window to view a webpage, I just hit the back button.
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5182
  • View blog
  • Posts: 26,879
  • Joined: 10-May 07

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:10 AM

View Postkummu4help, on 17 Dec, 2008 - 01:08 AM, said:

but i am unable to do this on my site in x10hosting.com.

Since you can't create a folder using their control panel, you'll need to contact them since it's their server.

There really isn't anything we can do from outside.
Was This Post Helpful? 0
  • +
  • -

#8 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:12 AM

I see what you are trying to do now.

Apache doesn't load folders anywhere but the ROOT WEB DIRECTORY, which in this case is public_html.

You can't get by this one.
Was This Post Helpful? 0
  • +
  • -

#9 kummu4help  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 245
  • Joined: 05-August 08

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:16 AM

i am able to create folder there and also able to put my files in that folder.

but the only thing is i am unable to refer them through relative path.
that's it.

i have a folder public_html in which i have my index.html page
i have another folder called collection. now i want to use the css file in this collection folder in index.html page.

*EDIT*that is what i am unable to do*EDIT*

hope i am clear this time......

This post has been edited by kummu4help: 17 December 2008 - 12:21 AM

Was This Post Helpful? 0
  • +
  • -

#10 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 12:20 AM

Your code:

<link rel="stylesheet" type="text/css" href="../xyz/style.css" media="all">



Is wrong then...

The "../xyz/style.css" is your problem here.

../ is the UNIX command to DROP ONE LEVEL of directories. When you do this, you are telling the index.html script to drop one directory and look for the directory "/xyz" which is BELOW the public_html directory.

You simply CANNOT do this. Your files / folders MUST be within the public_html folder, or they simply will not work. No questions asked, 100% of the time, will NOT work when loading from a web browser.



<link rel="stylesheet" type="text/css" href="xyz/style.css" media="all">



^ That is the code you would use to reference a directory one level HIGHER than the current directory (public_html).


I hope this clears everything up.
Was This Post Helpful? 0
  • +
  • -

#11 MorphiusFaydal  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 43
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: how to put files in other than public_html folder

Posted 17 December 2008 - 01:48 AM

He didn't have it wrong when he said ../xyz/foo.bar... That's what he wants to do. From what I understand, he wants a folder layout like this:

/
/somefile.txt

/public_html/
/public_html/index.htm

/xyz_folder/
/xyz_folder/style.css



With index.html referencing stuff from xyz_folder. Which you're right... You can't do. Ever.
Was This Post Helpful? 1

Page 1 of 1