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

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.
    点赞 评论

相关推荐 更多相似问题