1

例如:在苹果网站上,当我访问 apple.com/support 时,我会访问 apple.com/support/,应该是 apple.com/support/index.html,但 index.html 没有显示。

我想在我的网站上看到这个:例如,当去 jonathangurebo.se/contact 时,我会来到 jonathangurebo.se/contact/index.html,我不想显示 index.html。

我应该如何解决这个问题?

也许在我的 .htaccess 文件中添加一些行?因为当去 jonathanurebo.se/mlkhgljfehgljfebgfgb 时,它会来到我的错误 404 页面并在我的地址栏中显示相同的链接。而不是这种情况下的真正链接 jonathanurebo.se/error/404.html

4

4 回答 4

3

您的网站显示该index.html部分的唯一原因是您将其添加到 HTML 页面中。而不是像这样制作:

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

您应该制作如下链接:

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

一切都会像您预期的那样工作!:)

于 2013-03-07T21:16:56.460 回答
0

index.html 或 index.php 主要是默认文件,每个浏览器“首先查看”链接到 www.jonathangurebo.se/contact/ 并且它将自动打开 www.jonathangurebo.se/contact/index.html 而不显示“ index.html”在浏览器中

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

于 2013-03-07T21:08:21.460 回答
0

你是对的,你需要在你的 .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]
于 2013-03-07T21:10:26.497 回答
0

DirectoryIndexRedirect

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

如果您在某处设置了此指令,则必须将其删除。或者,如果您被允许在 .htaccess 中覆盖它,请使用

DirectoryIndexRedirect off
于 2013-03-07T21:16:12.797 回答