Link to home
Start Free TrialLog in
Avatar of MohammadAliQureshi
MohammadAliQureshi

asked on

How Do I go One Folder up in HTML

Hello EE Gurus ...
I have a folder called scripts  that is one level up than my domainname.com (Where all of my pages are) folder.
However, I can not access the script folder from the <script> {or from the <img src=".."> tag.

The code I am using is as follows:
   <script type="text/javascript" src="../scripts/validateRegForm.js"></script>
I have used every possible combination I can think of (Forward slash, backward slash, using ./ instead of ../).

When I try to go up one level in image tag, the image does not show up. However, the strange thing is that when I right click the image (what ever is being displayed instead of the image), and go to properties, the URL is always www.mydomain.com/images/image.gif.

This is an urgent request and would appreciate if this is resolved as quickly as possible.

Thanks
<<< Ali >>>
 
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

alternatively, use:

<script type="text/javascript" src="/scripts/validateRegForm.js"></script>

<img src="/images/whatever....">

?
Avatar of MohammadAliQureshi
MohammadAliQureshi

ASKER

@ryancys:: Will the code you suggest assumes that the scripts folders are under the domain.com (WWW)folder?

Hwever, I want all of my scripts out of the WWW directory (In this way the scripts will not be accessible via www.domain.com/scripts).

Thanks,
<<< Ali >>>
so where your "scripts" folder located at?

>>In this way the scripts will not be accessible via www.domain.com/scripts

is your scripts are in javascript or server side scripting? if your scripts are in javascript, you can't prevent public internet user to access it, because it's client side technology, which downloaded to client end to run.
@ryancys::

My scripts are in root folder instead of WWW folder. Here is how my folder structure looks like:

ROOT
|
DomainName.com (This is where my page is).

What I want is this

   ROOT  
_____|__________
|                                 |
scripts                  DomainName.com (Pages resides here)  
My page is a combination of Javascript and PHP (BTW PHP include and require works fine!. It is the HTML part that does not work).
To avoid that someone use the following URL to access my scripts:
http://www.domainname.com/scripts
I want to put them in the ROOT Directory instead of WWW directory.
Hope this helps....
Thanks
<<< Ali >>>
>>To avoid that someone use the following URL to access my scripts

if you try to avoid someone to access your scripts, but you want to "use" it on your website, I can tell you it's impossible.

However, you still can put the scripts folder in www, before that, may I know what web server you're using to host php? IIS or Apache HTTP server?

@ryancys:

I believe my host uses Apache servers ...

Why the location has to be WWW directory?

Thanks,
<<< Ali >>>
I came across this problem recently and it is my understanding after much investigation that on an Apache server it is possible to do this to a very small degree but only for retrieving variables.

The limitation appears that you can do a php include to retrieve hidden variables such as database user
& passwords eg. <?php include("../vars/hiddenvars.php"); ?>   but you won't be able to do much more than that, I'm certain that will include scripts.  The problem is that if you have a relative link in the php file you have included to a directory above the root it will always be run as being inside the root domain.

If you are trying to run the script above the root for security reasons, such as it contains passwords or sensitive data in variables, your best bet would be to strip them out of the script and retrieve them using a php include (or perhaps a java equivalent), then call the script that will use the variables you just imported at run time.

Hope this gets you on the right path.
ASKER CERTIFIED SOLUTION
Avatar of MohammadAliQureshi
MohammadAliQureshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ali,
I got whats ur point.. u cant do that, because, on WWW, you cannot access folder outside ur Domainname.com
So, its practically not possible, put ur scripts folder inside it and try to access it as...

/scripts
./scripts

above 2 will work fine.. :)

HTH
Manavsi