dongleiwei2182 2014-01-28 13:35
浏览 31
已采纳

HTAccess - 重定向所有页面并获取数据

I have a quick question.

So I have my rule, which is;

RewriteRule    ^([a-z0-9\-\/]+)/?$    index.php?requested_page=$1    [NC,L]    # Handle requests.

How do I change this to forward any get data to the pages that get requested? Index.php is a template basically, that pulls in data from other pages depending on which URL is requested. The template is basically as follows;

         $sitePageHashMap = array(
                "home" => "home",
                "pretty-link" => "pagename",
                "pretty-link" => "pagename",
                "pretty-link" => "pagename"
            );

Thanks,

Harry

  • 写回答

1条回答 默认 最新

  • doujiu3095 2014-01-28 13:40
    关注

    Use QSA flag:

    RewriteRule ^([a-z0-9/-]+)/?$ index.php?requested_page=$1 [NC,L,QSA] 
    
    • QSA (Query String Append) flag preserves existing query parameters while adding a new one.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 socket通信实现多人聊天室疑惑
  • ¥15 DEV-C++编译缺失
  • ¥33 找熟练码农写段Pyhthon程序
  • ¥100 怎么让数据库字段自动更新
  • ¥15 antv g6 力导向图布局
  • ¥15 quartz框架,No record found for selection of Trigger with key
  • ¥15 锅炉建模+优化算法,遗传算法优化锅炉燃烧模型,ls-svm会搞,后面的智能算法不会
  • ¥20 MATLAB多目标优化问题求解
  • ¥15 windows2003服务器按你VPN教程设置后,本地win10如何连接?
  • ¥15 求一阶微分方程的幂级数