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

请教大佬写一个 apache rewrite 的实现

  •  
  •   fengzl · Apr 7, 2023 · 1458 views
    This topic created in 1193 days ago, the information mentioned may be changed or developed.

    如题,想要实现 http://test.com/a/b 重定向到 http://test.com/?type=a&val=b 这样的实现,用的 apache 服务器,想要写一个 rewrite 实现这样的需求应该怎么写,谢谢大佬

    defunct9
        1
    defunct9  
       Apr 7, 2023
    RewriteRule ^a/b$ results.php?type=a&val=b [QSA]
    defunct9
        2
    defunct9  
       Apr 7, 2023
    RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+) ?type=$1&val=$2 [QSA]
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3070 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 13:49 · PVG 21:49 · LAX 06:49 · JFK 09:49
    ♥ Do have faith in what you're doing.