Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1064131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:53:07+00:00 2026-05-16T18:53:07+00:00

I am trying to create a very basic MVC framework to better understand the

  • 0

I am trying to create a very basic MVC framework to better understand the pattern.

I am having trouble understanding the URL routing part.
So far i’ve understood that the url carries 3 basic pieces of information in this format:
http://www.site.com/controller/method/querystring

So given the following URL:

www.site.com/user/delete/john

'user' is the controller
'delete' is the method of said controller
'john' is the query string

In my framework, i have it so if a controller is not specified in the URL, it defaults to ‘index’.
If a method if not specified in the URL, it defaults to ‘show'(which just outputs the html).

this way i can go to http://www.site.com and since it doesn’t have a controller or method in the url, the
controller becomes ‘index’ and method ‘show’, thus just loading the index view.

But what if i don’t want to provide a method in the url, but just http://www.site.com/controller/querystring
like so:
http://www.site.com/user/john

This would ideally load the profile for John.
But, the framework thinks ‘john’ in the url is the method to invoke, and not the query string.

What is the standard, a practical way to distinguish between the two?

ps:

I have this in my .htaccess

RewriteRule ^(.*)$ index.php?$1 [L,QSA]

echoing $_SERVER[‘QUERY_STRING’] in to http://site/profile/john gives ‘profile/john’/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:53:08+00:00Added an answer on May 16, 2026 at 6:53 pm

    My controllers usually locate a handler method searching from more to less specific. If a method is found, it’s called with the “tail” of parameters passed to it. For example, if user/delete/john is given, it attempts to call, in order:

     action_user_delete_john()
     action_user_delete('john')
     action_user('delete/john')
     generic_fallback_method('user/delete/john')
    

    In your case, i’d define a set of user_<operation> methods (action_user_delete, action_user_edit etc) and a default action_user method which will be called when no operation param is provided and should handle urls like user/john

    I find this technique quite flexible and powerful, but there’s no standard, and you’re free to invent your own.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a very basic chat system, part of which will be
I'm having a very basic problem: I'm trying to create a new theme for
I am trying to create a very basic sprite image. First off i have
I'm trying to create a very basic Setup and Deployment project using Visual Studio.
I'm currently trying to create a template in TextMate. The template is very basic:
I'm currently working on trying to create a very basic bare bones instant messenger
I am trying to create a very basic flash game, using Tom Krcha's P2P
Overview I am trying to create a very basic scraper with PhantomJS and pjscrape
simple question. I'm trying to create a new object for a very basic class
I am trying to create a very generic generics repository for my Entity Framework

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.