删除子文件夹中的索引文件的.html

时间:2017-06-08 08:21:55

标签: html

我刚刚推出了我网站的英文版,在/ en子文件夹中添加了index.html文件。

现在,我无法访问produktionskollektivet.com/en/(它返回403 Forbidden),但必须链接到produktionskollektivet.com/en/index.html。

我在.htaccess中有一个重写规则应该删除.html扩展名,但这似乎不适用于此实例。

以下是我的.htaccess文件中的内容:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
Redirect 301 /hej-hbg.html /index.html

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

使用 .htaccess 文件删除 .html 扩展名:

DirectoryIndex somepage.php home.php welcome.php index.html index.php landingpage.html

~放在你想删除扩展的地方。

注意:使用 .htaccess 扩展名保存文件。

这对我来说很简单且有效,希望能帮到你。