• 请不要在回答技术问题时复制粘贴 AI 生成的内容
luckyc
V2EX  ›  程序员

求教如何用.htaccess 替换

  •  
  •   luckyc · Dec 5, 2019 · 2380 views
  •   You need to sign in to view this topic
    This topic created in 2544 days ago, the information mentioned may be changed or developed.
    154.213.16.199

    原来是伪静态, 搬家了之后不知为什么伪静态一直调试不成功,
    索性改成了生成 html, 生成到了 html 目录
    想请问如何用 htaccess 做 301 跳转啊.
    把上面的地址跳到下面.
    ```

    http://www.xx.com/index.html
    http://www.xx.com/index.html

    http://www.xx.com/abc.html
    http://www.xx.com/html/abc.html


    http://www.xx.com/news/ssgg/2754.html
    http://www.xx.com/html/news/ssgg/2754.html

    ```
    ....
    1 replies  •  2019-12-05 18:31:19 +08:00
    yernsun
    yernsun
    Dec 5, 2019
    1
    为啥不用 nginx 呢?
    ```
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(?!\/?html\/.+)$ /html/$1 [L]
    ```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   972 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 18:48 · PVG 02:48 · LAX 10:48 · JFK 13:48
    ♥ Do have faith in what you're doing.