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 8587319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:32:29+00:00 2026-06-11T22:32:29+00:00

I’m not sure if it’s possible, but what i need is to load default

  • 0

I’m not sure if it’s possible, but what i need is to load default controller and action if specified controller has not been found from the url, so let’s say if i have this url:

http://mywebsite.com/john

It would have to call user controller and selected_user action,

And if i have url http://mywebsite.com/pages/profile

it would have to call pages controller and profile action because both has been specified and found

Is there a way to do it?

I am using Kohana 3.2

EDIT Here is my htaccess:

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /ep/

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [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]

/ep is my directory in htdocs also i did set 'base_url' => '/ep/', in my bootstrap as well

  • 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-06-11T22:32:30+00:00Added an answer on June 11, 2026 at 10:32 pm

    Assuming mod_rewriting is enabled and the .htaccess file is configured correctly. All you need to do is specify a new route within the bootstrap, after the current default one.

    For example:

    <?php
    
      Route::set('default', '(<controller>(/<action>(/<stuff>)))', array('stuff' => '.*'))
        ->defaults(array(
            'controller' => 'welcome',
            'action' => 'index',
      ));
    
      /** Set a new route for the users **/
      Route::set(
        "users", "<name>", array("name" => ".*")
      )->defaults(array(
        'controller' => 'users',
        'action' => 'selected_user'
      ));
    
      /** Within the selected_user method you can then check the request for the "name" 
        validate the user parameter (parhaps against the db) and then again route the correct
        pages/profile if found
    
        e.g.
      **/
    
      $username = $this->request->param('name');
      if ($username == "alexp") {
        /** reroute to the users/profile controller with data **/
      }
    
    ?>
    

    Edit: also I forgot to mention that the above routes will be called for anything after the base Uri so “http://mysite.com/john” and “http://mysite.com/89s88” will also try to use that route. You could imagine allot of routes being needed over time, so best at least stick to a minimum of /controller/action varieties or you may other wise find yourself with some complicated regex in the routes where it is unneeded.

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I need to clean up various Word 'smart' characters in user input, including but
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.