When I type URL


in browser address bar, browser redirecting to that location and shows the documents available. But when I use same url in href browser not redirecting to the href location.

echo '<a href="file://///server01\PUBLIC\PEG\">click here</a>';
echo '<a href="file://///server01/PUBLIC/PEG/">click here</a>';


php code is not working. When I click click here nothing will be happend.Browser not redirecting to corresponding location.
I tested in all browsers. Application running in remote server.

Edited by venkyb47

5 Years
Discussion Span
Last Post by cwarn23

The file:// protocal only works in localhost and instead you need to use the http:// address to your file. For example: If you were to type into the url bar to download the file www.example.com/peg/ then the code would be as follows.

<a href="http://www.example.com/peg/">click me</a>

Also the url demonstrated will open the directory the file is in rather the download it. To download it you will need something like the following.

<a href="http://www.example.com/peg/download.zip">click me</a>

server01 is the host name.

I cannot user http:// to open document location.If I type this in browser URL


browser shows **The address is not valid **

The follwoing code is working in IE 8 but not in mozilla and chrome.

echo '<a href="file://///server01\PUBLIC\PEG\">click here</a>';
echo '<a href="file://///server01/PUBLIC/PEG/">click here</a>';

How to make this code works for all browsers?


http:////server01/ is not a valid host name. Editing the hosts.cfg file I belive it's called will not publish your localhost site on the internet. You will need to purchase what is called a "domain name" and in addition to that if you wish to run it off your computer you will need to "port foward". Also after purchasing the domain name you will need to configure the "dns" with a program such as "bind" but in general it is a lot easier to pay monthly for a "web host". Some web hosts are free with certain limitations. So I would strongly recommend purchasing a webhost rather than trying to run it off your own computer.

Edited by cwarn23

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.