0

Any idea how to browse file:///C:/Results/index.html from localhost using a href?

i created the test html file (C:/ser/xampp/htdocs/filter/file.html) and place the link to local page (C:/Results/index.html) and i tired to open that link from (http://localhost/filter/file.html) it didn't work. But when i tired to open link from (file:///C:/ser/xampp/htdocs/filter/file.html) it worked.

I hope this make sense.

I googled it but didn't find any useful solution. Any idea how to solve this?

4

1 回答 1

1

如果路径如下所示,并且如果您从 localhost 访问,它将搜索 htdocs 文件夹内的文件

<a href="file:///C:/Results/index.html">Click Here</a>

要访问 C:/Results 文件夹,请为 C:/Results 创建一个 VirtualHost,并将相应的 ip 分配给 href,如下所示。这样您就可以从 localhost 访问该文件。

<a href="http://192.168.1.4:1003/index.html">Click Here</a>

要创建 VirtualHost, * 打开 /etc/apache2/httpd.conf 并输入以下行。不要删除其他行

<VirtualHost 192.168.1.4:1003>
DocumentRoot "file:///C:/Results"
</VirtualHost>

* 打开 /etc/apache2/ports.conf 并输入以下行。不要删除其他行

Listen 1003

* 重启阿帕奇。

于 2013-07-31T05:05:27.250 回答