Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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 我想从url中删除index.html_.htaccess - Fatal编程技术网

.htaccess 我想从url中删除index.html

.htaccess 我想从url中删除index.html,.htaccess,.htaccess,我已经设置了访问我的laravel网站的权限。我几乎重定向了URL。但当我试图从url中删除index.html时,它不起作用。如何从url中删除index.html 我想从url中删除index.html。现在它给出了404页未找到 我尝试过简单的重定向,但它提供了许多重定向,重定向301/index.html 第二次尝试 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule

我已经设置了访问我的laravel网站的权限。我几乎重定向了URL。但当我试图从url中删除index.html时,它不起作用。如何从url中删除index.html

我想从url中删除index.html。现在它给出了404页未找到

我尝试过简单的重定向,但它提供了许多重定向,重定向301/index.html

第二次尝试

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([^\.]+)$ $1.html [NC,L]
第三次尝试

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ 
RewriteRule ^index\.html$ http://example.com/ [R=301,L]
RewriteCond %{THE_REQUEST} \.html 
RewriteRule ^(.*)\.html$ /$1 [R=301,L]

有人要回复吗?不要使用复杂的重写规则,看一看apache提供的
DirectoryIndex
目录。@arkascha能否请你具体说明一下
DirectoryIndex
如何解决OP的问题:)?有人要回复吗?不要使用复杂的重写规则,看一下
DirectoryIndex
apache提供的目录。@arkascha您能否具体说明一下
DirectoryIndex
如何解决OP的问题:)?
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ 
RewriteRule ^index\.html$ http://example.com/ [R=301,L]
RewriteCond %{THE_REQUEST} \.html 
RewriteRule ^(.*)\.html$ /$1 [R=301,L]