Answer the question
In order to leave comments, you need to log in
How to redirect browser from http:// to file://?
Good evening. There is a page (index.php) on the site (http), you need to make sure that when you visit this page there is a redirect to file:///C:/readme.txt and the browser reads the data from the readme.txt file, displays them on the page or downloaded the file.
I tried to write a standard redirect to php (index.php) through the headers
header('Location: file:///C:/readme.txt') did not help: the browser gives a network protocol error, instead of the contents of the file, question marks, a server error.
Answer the question
In order to leave comments, you need to log in
The file:// address is opened by the browser only in two cases.
1. If this is the address of the page being opened (directly opened by the user, through the "open" menu or by typing the address into the address bar).
2. If this address is a link on a page that has the file:// address.
Any other options are considered unsafe by default, and will not work without a user-specific reconfiguration of the browser.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question