Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 始终使用.htaccess显示目录索引文件_Php_Apache_.htaccess_Url_Mod Rewrite - Fatal编程技术网

Php 始终使用.htaccess显示目录索引文件

Php 始终使用.htaccess显示目录索引文件,php,apache,.htaccess,url,mod-rewrite,Php,Apache,.htaccess,Url,Mod Rewrite,如果这是我的网站,并且用户键入了此url: 如何使每次有人访问主页时都像这样: 您可以在文档\u ROOT/.htaccess文件中使用RedirectMatch指令: RedirectMatch 302 ^/?$ /index.php 或者使用mod_重写: RewriteEngine On RewriteRule ^/?$ /index.php [L,R]

如果这是我的网站,并且用户键入了此url:

如何使每次有人访问主页时都像这样:


您可以在
文档\u ROOT/.htaccess
文件中使用
RedirectMatch
指令:

RedirectMatch 302 ^/?$ /index.php
或者使用mod_重写:

RewriteEngine On
RewriteRule ^/?$ /index.php [L,R]