Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在链接中隐藏.html扩展名_Html_Hyperlink_Hide - Fatal编程技术网

在链接中隐藏.html扩展名

在链接中隐藏.html扩展名,html,hyperlink,hide,Html,Hyperlink,Hide,假设我在public_html/index.html上有这样一个链接: <a href="pictures/index.html">Link to picture</a> 由于“图片链接”有自己的文件夹,并使用index.html,通常,如果我输入“www.mywebsite.com/pictures”,该扩展名将被隐藏。但是,如果我首先进入“www.mywebsite.com”,然后单击该链接,它将在地址栏中显示为“www.mywebsite.com/pictur

假设我在public_html/index.html上有这样一个链接:

<a href="pictures/index.html">Link to picture</a>

由于“图片链接”有自己的文件夹,并使用index.html,通常,如果我输入“www.mywebsite.com/pictures”,该扩展名将被隐藏。但是,如果我首先进入“www.mywebsite.com”,然后单击该链接,它将在地址栏中显示为“www.mywebsite.com/pictures/index.html”。如何在链接中隐藏“index.html”?我试过这个,但不起作用:

<a href="pictures/">Link to picture</a> <---this simply opens the file directory

将以下内容添加到您的
httpd.conf
文件中:

DirectoryIndex index.html

默认情况下,如果不传入文件名
index.html
而不是目录内容

,您是在本地测试还是在服务器上测试?httpd.conf到底是什么?我使用Hostgator,他们使用Apache。我知道有一个.htaccess,但从来没有听说过httpd.conf,我甚至不认为我有那个文件。你也可以把那个代码片段放在你的
.htaccess
文件中:)