开发者

Rewrite url: serve both query string and block urls

my journey of learning MVC continues and as hard as it is, I'm learning a lot of things I could never learn otherwise. Now I have faced the problem in routing. Currently I'm taking the $_SERVER["REQUEST_URI"] and get the controller and method and any args. When url is in format http://mysite.com/forum/thread/12/1123 there is no problem but I need to catch also requests like http://mysite.com/index.php?forum=12&&thread=1123. I have read links in threads below but cannot get my head on QSA and I though I would better ask.

Thanks

mod_rewrite: Check for Custom query string in URL? Rewrite开发者_高级运维 url with query string in htaccess


I ended up writing something like before: I redirect using htaccess

//No Controller specified in url (The current url is base url like http://example.com/hosanna_framework/)
if(!isset($_GET['base_url'])){
    $url = $config["router"]["default_controller"];
}
//Controller is specified in url
else{
     $url = $_GET['base_url'];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜