`
ruziniu
  • 浏览: 18000 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

更改Apache默认起始(索引)页面:DirectoryIndex

阅读更多

Apache默认索引页面是index.html,修改成其他文件需要修改httpd.conf文件:

 

# # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # < IfModule dir_module > DirectoryIndex index.html index.php </ IfModule >

 

可在Apache根目录建立一个负责跳转的index.php,比如输入IP地址直接跳转到http://ip/myweb/

 

<? php if ( ! empty ( $_SERVER [ ' HTTPS ' ]) && ( ' on ' == $_SERVER [ ' HTTPS ' ])) { $uri = ' https:// ' ; } else { $uri = ' http:// ' ; } $uri .= $_SERVER [ ' HTTP_HOST ' ]; header ( ' Location: ' . $uri . ' /myweb/ ' ); exit ; ?>

 

分享到:
评论

相关推荐

    PHP 默认目录 apache默认目录 apache默认页面

    在Apache的配置中,`DirectoryIndex`指令定义了这些默认页面的顺序。如果`index.html`存在,它将首先被显示;如果不存在,Apache会尝试其他列出的文件,如`index.php`。 在这个给定的压缩包中,我们看到以下几个...

    apache报Cannot serve directory No matching DirectoryIndex (index.html) found的解决办法

    1. **检查DirectoryIndex设置**:Apache服务器通过`DirectoryIndex`指令来确定应该显示哪个文件作为目录的默认页面。在`httpd.conf`配置文件中,找到并确认`DirectoryIndex`指令是否正确设置。例如: ``` ...

    Apache配置多端口及Apache端口修改方法

    如果你希望使用不同的文件作为默认索引页,可以通过修改`DirectoryIndex`指令来实现。 总之,Apache提供了强大的配置选项,允许用户根据需求灵活地配置端口、虚拟主机和其他关键参数。通过上述步骤,您可以有效地...

    apache和php本地测试环境配置说明

    - 设置默认索引页面:通过`DirectoryIndex`参数指定索引页面的顺序,例如`DirectoryIndex index.php index.php3 index.html index.htm`。 - 启用虚拟主机:取消注释`Include conf/extra/httpd-vhosts.conf`行以...

    iasp2.1让APACHE支持ASP

    IaspConfig rules "C:/IASP2101/properties/rules.properties" 7 通过更改httpd.conf更改apache的默认首页: DirectoryIndex index.htm   DirectoryIndex index.php   DirectoryIndex index.asp 更改完毕后,...

    用apache和php创建交互网站

    2. **修改Apache配置**:利用文本编辑器的查找功能,搜索字符串“DirectoryIndex”。找到后,修改为支持PHP文件的索引,如: ```conf DirectoryIndex index.html index.html.var index.php ``` 3. **启用PHP模块*...

    apache openssl配置快速的https网站

    Apache 和 OpenSSL 的集成是创建安全、加密的 HTTPS 网站的关键步骤。在这个过程中,我们需要配置 Apache...记得在每个更改后重启 Apache 以应用新的配置。同时,根据实际需求调整这些设置,以优化服务器性能和安全性。

    Windows 2003(XP)下安装配置Apache2.2.17+PHP5.2.17+mysql5.5.11服务器

    - 修改默认首页文件名:在 httpd.conf 文件中找到 `DirectoryIndex` 行,并将其修改为: ```conf DirectoryIndex index.html index.htm index.php ``` #### 四、PHP 的安装与配置 1. **解压 PHP 安装包**到 `D...

    bugfree部署文档

    修改为:DirectoryIndex index.php index.html 4) 找到:AddType application/x-gzip .gz .tgz 添加这两行: AddType application/x-httpd-php .php(.前有空格) AddType application/x-httpd-php .html(.前有空格) 5...

    Apache服务器.ppt

    Apache 服务器支持目录索引和默认页面。当用户访问一个目录时,Apache 服务器将显示该目录下的文件列表或默认页面。 可以使用 DirectoryIndex 指令来指定默认页面,例如: ``` DirectoryIndex index.html ``` 这将...

    Windows下配置php+apache+mySQL文档

    2. 在`httpd.conf`中找到`DirectoryIndex`行,添加`index.php`作为默认索引文件,如`DirectoryIndex index.html index.html.var index.php`。 3. 将Apache默认目录`C:\Program Files\Apache Software Foundation\...

    在线客服源码客户端php源码

    2. 修改 c:apachehttpd.conf,去掉ServerName前的“#”号,后面  跟本机的IP地址 3. 运行 c:apacheapache -i 将Apache安装成为Windows 2000的一个服务 4. 运行 net start apache 启动Apache 5. 将 c:...

    在线客服源码PHP源码

    2. 修改 c:apachehttpd.conf,去掉ServerName前的“#”号,后面  跟本机的IP地址 3. 运行 c:apacheapache -i 将Apache安装成为Windows 2000的一个服务 4. 运行 net start apache 启动Apache 5. 将 c:...

    Apache使用说明书

    通常,你可能希望包含多个默认页面选项,以防某些页面格式不被支持。例如: ```apacheconf DirectoryIndex Index.htm Index.php Index.php3 Index.cgi Index.pl Default.htm ``` 这样,如果用户直接访问目录,...

    Apache2.2中文文档

    9. **目录索引**:DirectoryIndex指令可以指定当用户访问一个目录时,默认显示哪个文件。 10. **CGI和FastCGI**:Apache支持运行CGI(通用网关接口)脚本,而FastCGI则提供更高效的CGI执行环境,常用于PHP等脚本...

    apache+mysql+php配置手册

    - **修改默认路径**:Apache服务器的默认根路径为`$APACHE$\htdocs`。如果希望将其更改为其他路径,可以在`httpd.conf`文件中修改`DocumentRoot "$APACHE$\htdocs"`这行代码。 - **修改默认首页**:在`httpd.conf`...

    apache+php+mysql配置

    文档中提到安装顺序为:Apache → PHP → MySQL → Zend。对于 PHP 的安装,因为提供的是 ZIP 包,可以直接解压即可。以下是具体的安装步骤: 1. **Apache**:文档中将其安装到了 E 盘根目录下(E:\apache2)。 2. ...

Global site tag (gtag.js) - Google Analytics