C
C
c0de2018-06-25 20:15:45
PHP
c0de, 2018-06-25 20:15:45

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

2 answer(s)
S
SagePtr, 2018-06-25
@c0de

No way. That would be a hole.

A
Adamos, 2018-06-25
@Adamos

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 question

Ask a Question

731 491 924 answers to any question