how to place files in other than www folder

giganticgaint

New Member
Messages
8
Reaction score
0
Points
0
Hi
this is my site. http://forums.x10hosting.com/programming-help/www.eway.exofire.net
at present all my files are in public_html folder.
i want to move some of them to other folders(css, javascript files)

how can i do that and to which folders i can move.
also after moving them to other folder how can i refer them.
i tried to move them to other folders but i am unable to refer them in my script


all in all what i want to do is, i would like to have a folder say, XYZ(this folder should not be in public_html. it should be out of public_html). and i want to place my .js files in this folder.After that in my index.html page i want to refer those .js files using relative path.

any help pls.....
 
Last edited:

blobtech

New Member
Prime Account
Messages
17
Reaction score
0
Points
1
If you have your html file (index.html) like this: /public_html/index.html and your css file: /public_html/css/index.css,
you can refer to it using "css/index.css".

You could also use a double-dot to go a directory back.
Say, if you have your html file (index.html) like this: /public_html/test/index.html and your css in /public_html/css/testindex.css,
you can refer to it using "../css/testindex.css".

If you need to go multiple directories back, just treat them as a normal dir "../../../../css/testindex.css" (goes 4 dirs back, then one forward into "css").

Please note that this still requires all files and directories to be inside public_html.
If you want to serve from other directories (like /etc), you should look up mod_rewrite or aliases.
 

giganticgaint

New Member
Messages
8
Reaction score
0
Points
0
If you want to serve from other directories (like /etc), you should look up mod_rewrite or aliases.

Thanks blobtech,
but i want exactly what u said. but instead of etc,
i have created a directory called personal and i want to refer files in that directory. at present i am trying to do this but it's not working;
Code:
<link rel="stylesheet" type="text/css" href="../personal/style.css" media="all">

can u help me plss... i don't know anything about mod_rewrite.
so can u show me some example regarding this...

thanks
 

vol7ron

New Member
Messages
434
Reaction score
0
Points
0
If you don't know what you're doing, you should consult with an admin before trying to do something outside of public_html

You could open a known security hole, especially if you redirect improperly.
 

blobtech

New Member
Prime Account
Messages
17
Reaction score
0
Points
1
I should have added to my post:
Folders on the user-root level are not for public files, any security hole in the website could potentially cause a lot more damage there.
Its therefor highly discouraged and I don't know if its even allowed at x10hosting!

Next to that, it would probably not solve your problem:
giganticgaint at forums.x10hosting.com/review-my-site/92589-www-eway-exofire-net.html said:
anyone can see my css,js files
so i want to move them to a secure folder.
Any additional files like scripts, stylesheets and images referred on a public page cannot be made inaccessible.
Since all of them need to be downloaded by the webbrowser to display the page. (And thus all of them will end up on the viewers computer)
People always will be able to read them. If its done by typing the url, or copying out of the cache, it doesn't matter.

You can hinder possible copiers to some extent, but in the end they will always get the files.
 

vol7ron

New Member
Messages
434
Reaction score
0
Points
0
I did not see that in the original post, he must have changed it.


That is also correct, the css/js/html, anything that is used in the browser window is downloaded to the browser's machine. So each user downloads a copy of that file to their temporary internet directory.

If there are files that are not used for the site that you do not want users to access, simply change the permissions on the file, or use .htaccess/.htpasswd to limit the users from accessing files (http://www.addedbytes.com/apache/password-protect-a-directory-with-htaccess/)

There is a way to dynamically create a folder, put css in there and then delete the files, that way users can not find the file by the browser, but it is pointless because the file will still be in their temporary internet folder.
 
Top