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,如果有人点击某个特定目录,我想强制URL为index.html。如何使用.htaccess执行此操作?您可以尝试以下规则: RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_URI} !index\.html$ [NC] RewriteRule ^(.*?)/?$ /$1/index.html [L,R=301]

如果有人点击某个特定目录,我想强制URL为index.html。如何使用.htaccess执行此操作?

您可以尝试以下规则:

RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !index\.html$ [NC]
RewriteRule ^(.*?)/?$ /$1/index.html [L,R=301]