Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
.htaccess 自动将index.php添加到URL的末尾_.htaccess - Fatal编程技术网

.htaccess 自动将index.php添加到URL的末尾

.htaccess 自动将index.php添加到URL的末尾,.htaccess,.htaccess,当用户访问我的站点时,将显示URL 如何将/index.php自动添加到URL的末尾以使其成为URL?您可以尝试以下方法: RewriteEngine On RewriteRule ^/$ http://%{HTTP_HOST}/index.php [R=301,L] 但是你为什么要这样做呢?你可以试试这样的东西: RewriteEngine On RewriteRule ^/$ http://%{HTTP_HOST}/index.php [R=301,L] 但是为什么要这样做呢?使用Dir

当用户访问我的站点时,将显示URL


如何将/index.php自动添加到URL的末尾以使其成为URL?

您可以尝试以下方法:

RewriteEngine On
RewriteRule ^/$ http://%{HTTP_HOST}/index.php [R=301,L]

但是你为什么要这样做呢?

你可以试试这样的东西:

RewriteEngine On
RewriteRule ^/$ http://%{HTTP_HOST}/index.php [R=301,L]

但是为什么要这样做呢?

使用
DirectoryIndexRedirect
指令

DirectoryIndexRedirect on

使用
DirectoryIndexRedirect
指令

DirectoryIndexRedirect on

谢谢你的回复。这给了我
内部服务器错误
,也许您的apache版本的响应低于2.4。这给了我
内部服务器错误
也许您的apache版本低于2.4