如何实现输入文件夹名,就可以执行文件夹名下的文件

xujian2009 2010-08-09 08:21:54
我用的Apache和php的搭配,在我的www的目录下有个文件夹admin ,admin夹下有个profile.html文件。我想实现输入http://localhost/admin ,就直接打开了profile.html文件,换句话说,要实现访问如下两个地址,能看到同一个页面(profile.html)的功能:
1、http://......./admin/
2、http://......./admin/profile.html 。有知道怎么做的吗?谢谢了。
...全文
86 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
xujian2009 2010-08-10
  • 打赏
  • 举报
回复
谢谢,解答。
Dleno 2010-08-09
  • 打赏
  • 举报
回复
1,2楼说的是对的.
找下看有没有host.conf的文件.
床上等您 2010-08-09
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 xujian2009 的回复:]

引用 2 楼 yangball 的回复:
配置默认文件

或者
rewirte


改了配置了,但是我输入http://localhost:8080/admin,会自动改成http://localhost:8080/admin/的形式,而且我看到的是文件目录的形式啊。
Index of /admin

* Parent Directory
* profile……
[/Quote]
那就是默认页没有生效了。
xujian2009 2010-08-09
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 amani11 的回复:]
你的 httpd.conf没有 directoryindex???

你添加了试试。记得重启。。。。

<IfModule dir_module>
DirectoryIndex profile.html index.php
</IfModule>
[/Quote]
改了配置了,但是我输入http://localhost:8080/admin,会自动改成http://localhost:8080/admin/的形式,而且我看到的是文件目录的形式啊。
Index of /admin

* Parent Directory
* profile.html
怎么回事啊?
xujian2009 2010-08-09
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 yangball 的回复:]
配置默认文件

或者
rewirte
[/Quote]

改了配置了,但是我输入http://localhost:8080/admin,会自动改成http://localhost:8080/admin/的形式,而且我看到的是文件目录的形式啊。
Index of /admin

* Parent Directory
* profile.html
amani11 2010-08-09
  • 打赏
  • 举报
回复
你的 httpd.conf没有 directoryindex???

你添加了试试。记得重启。。。。

<IfModule dir_module>
DirectoryIndex profile.html index.php
</IfModule>
xujian2009 2010-08-09
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 amani11 的回复:]
apache有项设置

DirectoryIndex index.php index.html……

你可以将profile.html添加到第一位

这样就算目录下有index.php,也优先显示profile.html
[/Quote]
您说的是配置 Apache的httpd.conf这个文件吗?我用的是phpstudy集成安装的啊,在这个文件中,没有找到你说的那个选项啊。
eros0405 2010-08-09
  • 打赏
  • 举报
回复
index profile.html index.html index.htm index.php;
床上等您 2010-08-09
  • 打赏
  • 举报
回复
配置默认文件

或者
rewirte
amani11 2010-08-09
  • 打赏
  • 举报
回复
apache有项设置

DirectoryIndex index.php index.html……

你可以将profile.html添加到第一位

这样就算目录下有index.php,也优先显示profile.html

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧