如何使用 .htaccess 提供没有扩展名的 html 文件(如果存在)或回退到 index.php

问题描述 投票:0回答:0

使用 apache .htaccess 是否可以实现以下目标:

  • 没有扩展名的 url 称为例如
    /
    ,
    /terms
    ,
    /products/one
    .
  • 如果相关的 html 文件存在(
    index.html
    terms.html
    products/one.html
    )然后它被提供。
  • 如果不存在,则使用查询字符串变量调用
    index.php
    ,例如
    index.php?path=terms
    .

我们该怎么做?

apache .htaccess url-rewriting
© www.soinside.com 2019 - 2024. All rights reserved.