0

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

1 Answer 1

0

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'];
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.