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

  • Home
  • SEARCH
  • 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 667651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:57:07+00:00 2026-05-13T23:57:07+00:00

I am working on a personal project based in PHP and MySQL, and I

  • 0

I am working on a personal project based in PHP and MySQL, and I am doing a bit of research and playing around with rewrites. Say I have a site…

http://www.myDomain.com/

And I want to have an index.php, or bootstrap, in the root of the domain. So if you access…

http://www.myDomain.com/admin/

It will still load from the index.php in the top level of the domain, which handles the parsing and loading of configuration files, and redirecting the user to the correct location, making pretty links along the way.

Where should I start in my research and education on this? I’m at a loss somewhat. Thank you for your time 🙂


Update:

Sounds like I do want to move towards a MVC system with a front controller. Any good references on writing my own MVC framework (would be very basic). I honestly don’t want to pull in the Zend Framework at this time (would bulk it up a lot!)

  • 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-13T23:57:08+00:00Added an answer on May 13, 2026 at 11:57 pm

    Basically, you rewrite any incoming request to your index.php. Here’s an example .htaccess from the Kohana framework:

    # Turn on URL rewriting
    RewriteEngine On
    
    # Protect application and system files from being viewed
    # RewriteRule ^(application|modules|system) - [F,L]
    
    # Allow any files or directories that exist to be displayed directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    # Rewrite all other URLs to index.php/URL
    RewriteRule .* index.php/$0 [PT,L]
    

    So your example of would be routed to index.php/admin. Then you can look at $_SERVER['REQUEST_URI'] to determine what to do next.

    A relatively common pattern would be to use the first segment of the URI as the controller, and the second as the method. So for example:

    $segments = explode($_SERVER['request_uri'], '/');//array('admin')
    
    if(isset($segments[0]))
    {
        $class = $segments[0].'_controller';//'admin_controller
    
        if(isset($segments[1]))
             $method = $segments[1];
        else
             $method = 'index';
    }
    else
    {
        $class = 'index_controller';
        $method = 'index';
    }
    
    $controller = new $class;
    $controller->$method();
    

    That code is by no means production ready, as it would die a fiery death, if for example the user visited a URL for a non-existent controller. It also doesn’t do nice things like handle arguments. But it’s kind of the idea behind how a PHP MVC framework operates.

    By the way, another name for what you’re calling bootstrap is front controller. You can google that term to find a lot more information about the pattern.

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

Sidebar

Related Questions

I am on working on a personal project to write a PHP website which
I'm working on a personal project (C# / ASP.NET) that will use LINQ to
I'm working on database designs for a project management system as personal project and
I've started working on a fairly complicated software. It is for a personal project,
Working on a project at the moment and we have to implement soft deletion
I am working on a personal project involving sending simple signals from my computer
I'm working on a personal project involving Javascript, and as part of that project,
I'm working on a personal project which is an RPC (client-server) in C++. The
I am working on a personal project in winforms just to gain some experience
I am working on a personal learning project to make a Minecraft clone. It

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.