Liquid Fire Posted September 11, 2008 Share Posted September 11, 2008 I don’t think this belongs in the MVC forum just because it is not talking about any one specific framework but if it does then please move it. Now I have been building a MVC Framework off and on for the past 5-6 months and it is coming along but there is one aspect that I am not really sure on which way to go, and that is handling URLs. Current my framework supports both query and segment type URLs. query : www.example.com/index.php?c=site&m=index&aasd=var1&erve=var2 etc... segment: www.example.com/index.php/site/index One thing to keep in mind is that I want to be able to have the cleanest looking url without mod rewrites. Now query urls are really the less preferred way and I am not even sure why I need to support it but I do. Basically there are 2 variable names the are configured(c and m by default) that store the controller name of the class you which to call and the method of the controller class you want to invoke. All other query variable are parsed as the parameters for the method if it has any. Also note, that is does not matter the name of the query variables, only the position. Now segment urls are the preferred way as they are the cleanest. Basically the first segment is the controller and the second segment in the method and all other segments are the parameters. Now currently I use the $_SERVER[‘REQUEST_URI’] as it has always had the full url after the .com all servers I have tried(which is probably like ten with a range of Linux OSes and a Windows Box that used Apache and IIS). Now if seems like this is the cleanest way of doing things as long as the $_SERVER[‘REQUEST_URI’] does not rely on any type of server configuration. Does $_SERVER[‘REQUEST_URI’] rely on any type of server configuration? Someone has told me to do something like this: www.example.com?url=site/index Because my way requires pathinfo to be configured but my apache is not configured with it. I don’t like that way because the url is to messy standalone. Are there any flaws/downsides in using $_SERVER[‘REQUEST_URI’]? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.