【问题标题】:Error with redirection of website with htaccess使用 htaccess 重定向网站时出错
【发布时间】:2018-10-21 00:06:32
【问题描述】:

我试图摆脱我网址中的 index.html。

.htaccess

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://saturnstudios.org/$1 [R,L]

每次我加载网站 https://www.saturnstudios.org/index 时,我都会收到错误 Error 404 - Not Found 您正在查找的文档可能已被删除或重命名。请联系网站所有者以获得进一步的帮助。

即使文件命名正确。

<h1 class="nav-link"><a href="index">Home</a></h1>
</li>
<li>
   <h1 class="nav-link"><a href="about">About</a></h1>
</li>
<li>
<h1 class="nav-link"><a href="contact">Contact</a></h1>

关于如何解决它的任何想法?

【问题讨论】:

    标签: html .htaccess


    【解决方案1】:

    你可以试试remove .html extension from url这个:

    RewriteCond %{REQUEST_FILENAME}.html -f
    RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [QSA,L]
    

    添加到最后。

    希望对你有帮助。

    【讨论】:

      【解决方案2】:

      您只需添加MultiViews 选项,通过在内部添加扩展后加载正确的文件来使其工作。

      将此行放在 .htacces 的顶部:

      Options +MultiViews
      

      【讨论】:

        猜你喜欢
        • 2015-10-22
        • 2012-11-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-28
        • 2022-08-02
        • 2013-06-04
        • 2020-04-09
        相关资源
        最近更新 更多