Removing 'index.html' from url and adding 'www' with one single 301 redirect

前端 未结 3 1456
礼貌的吻别
礼貌的吻别 2021-01-06 16:13

In order to remove index.html or index.htm from urls I use the following in my .htaccess

RewriteCond %{REQUEST_URI} /i         


        
3条回答
  •  盖世英雄少女心
    2021-01-06 16:41

    A better solution would be to place the index.html rule ahead of the www rule and inside the index.html rule ADD the www prefix to the destination url. This way someone looking for http://domain.com/index.html would get sent to http://www.domain.com/ by the FIRST rule. The second (www) rule would then only apply if index AND www are missing, which is again only one redirect.

提交回复
热议问题