HTML -脚本-隐藏"/index.html"文件时,转到domain.com/example

HTML - Script - hide the "/index.html" file when going to domain.com/example

本文关键字:quot 转到 example com domain index -脚本 隐藏 HTML html 文件      更新时间:2023-09-26

例如:在apple的网站上,当我去apple.com/support时,我会来到apple.com/support/,它应该是apple.com/support/index.html,但index.html没有显示。

我想在我的网站上:www.jonathangurebo.se例如,当去jonathangurebo。我将到jonathangurebo.se/contact/index.html,我不想显示index.html。

我该如何解决这个问题?

也许添加一些行到我的。htaccess文件?因为去jonathangurebo的时候。Se/mlkhgljfehgljfebgfgb它会来到我的错误404页面,并在我的地址栏显示相同的链接。这里不是真正的链接jonathangurebose/error/404.html

您的网站显示index.html部分的唯一原因是因为您将其添加到HTML页面中。而不是让like like so:

<a href="http://www.jonathangurebo.se/apps/index.html">Apps</a>

你应该创建如下链接:

<a href="http://www.jonathangurebo.se/apps/">Apps</a>

一切都会如你所愿!:)

index.html或index.php大多是默认文件,每个浏览器"首先看"链接到www.jonathangurebo.se/contact/,它会自动打开www.jonathangurebo.se/contact/index.html而不会在浏览器中显示"index.html"

试试http://www.jonathangurebo.se/contact/

你是对的,你需要添加一些东西到你的。htaccess文件。

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}'s(.*)/index'.php [NC]
RewriteRule ^ /%1 [R=301,L]

From DirectoryIndexRedirect

默认情况下,选择DirectoryIndex并透明地返回给客户端。

如果你在某个地方设置了这个指令,你必须删除它。如果你可以在。htaccess中重写它,使用

DirectoryIndexRedirect off