html - 如何隐藏名称结束 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>
解决方案
不要用不必要的东西把事情复杂化mod_rewrite
。只需使用DirectoryIndex index.html
.
推荐阅读
- android - 将 ViewPager2 与 TabLayout 和片段一起使用。能够交换片段,除非用户首先浏览到另一个选项卡,否则不会显示更新的片段
- vb.net - 有人可以帮我解决这个 SOAP 错误描述吗
- angular - 在 Nativescript 中显示带有标题的表格
- javascript - 如何使用 JavaScript / Node js 存储对象中不匹配的字符串
- while-loop - 斯威夫特:初学者问题 - 打印偶数
- java - 我的乱码。随机颜色和大小的圆圈
- c++ - 常量对象
- symfony5 - Symfony 5 Reusable Bundles 控制器没有容器集,你是否忘记将其定义为服务订阅者
- javascript - 如何更新父更改的反应组件?
- azure - 打包程序和安装后脚本