gpt4 book ai didi

.htaccess - htaccess 目录管理

转载 作者:行者123 更新时间:2023-12-04 07:51:42 26 4
gpt4 key购买 nike

我要问一个非常简单的问题。当我运行我的页面时,我不希望我的链接显示这个:

http://localhost/example/assets/gallery.php
我想要的是:
http://localhost/example/assets/
那么如何在 .htaccess 文件中做到这一点呢?
如果您能提供帮助,我将不胜感激,因为我在阅读论坛后感到非常困惑。
我的 htaccess 现在是这样的,但你知道它只有助于删除扩展名:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

最佳答案

如何制作 assets/gallery.php -> assets/

  • assets文件夹制作 .htaccess文件
  • 粘贴此代码:
    DirectoryIndex gallery.php

  • 此代码将目录索引(如 index.php 文件)更改为 gallery.php文件含义 gallery.php现在就像 index.php文件。

    关于.htaccess - htaccess 目录管理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66933838/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com