首页 > 解决方案 > 如何隐藏名称结束 url index.html

问题描述

我所说的 url 中的姓氏是什么意思,例如 index.html,例如我网站主页上的 url 链接。结果是这样的

https://hijaben.insomnia247.nl/index.html

我想删除或删除网址的姓氏(index.html)

我尝试使用 .htaccess 文件,但它根本不起作用。是否可能脚本错误或VPS不支持或什么?解决方案 ..?

文件 .htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html
</IfModule>

标签: htmllinux.htaccess

解决方案


不要用不必要的东西把事情复杂化mod_rewrite。只需使用DirectoryIndex index.html.


推荐阅读