V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
luckyc
V2EX  ›  程序员

求教如何用.htaccess 替换

  •  
  •   luckyc · Dec 5, 2019 · 1946 views
    This topic created in 2335 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
        1
    yernsun  
       Dec 5, 2019
    为啥不用 nginx 呢?
    ```
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(?!\/?html\/.+)$ /html/$1 [L]
    ```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1176 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 23:20 · PVG 07:20 · LAX 16:20 · JFK 19:20
    ♥ Do have faith in what you're doing.