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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:47:25+00:00 2026-06-13T01:47:25+00:00

According to the tutorial, it is possible to handle all the requests for static

  • 0

According to the tutorial, it is possible to handle all the requests for static pages through application/controllers/pages.php

class Pages extends CI_Controller {

    public function view($page = 'home')
    {
        if( ! file_exists('application/views/pages/'.$page.'.php'))
        {
            // Whoops, we don't have a page for that!
            show_404();
        }

        $data['title'] = ucfirst($page); // Capitalize the first letter

        $this->load->view('templates/header', $data);
        $this->load->view('templates/nav', $data);
        $this->load->view('pages/'.$page, $data);
        $this->load->view('templates/aside_right', $data);
        $this->load->view('templates/bottom', $data);
    }
}

This works for the “home”-page, but I don’t seem to be able to call views/pages/about for example.

I tried to make a seperate controller for the about-page. It works, but it feels somewhat wrong.

application/controllers/about.php

class About extends CI_Controller {

    public function index()
    {
        $this->load->view('templates/header');
        $this->load->view('templates/nav');
        $this->load->view('pages/about');
        $this->load->view('templates/aside_right');
        $this->load->view('templates/bottom');
    }
} 

I also have issues with my htaccess file or routes file. With the About-controller written above, I can only get to the page by typing domain.com/index.php/about. I’d like it to be domain.com/about etc.

This is what my routes.php’s like:

$route['about'] = 'about';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';

My Htaccess:

RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
  • 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-13T01:47:26+00:00Added an answer on June 13, 2026 at 1:47 am

    As you already said, you don’t need to use another controller for the about pages. Your problem is with your routes.php.

    $route['about'] = 'about';
    $route['(:any)'] = 'pages/view/$1';
    $route['default_controller'] = 'pages/view';
    

    In this way, it will search for a controller named “about” and it doesn’t find the controller. If you erase the first line:

    $route['(:any)'] = 'pages/view/$1';
    $route['default_controller'] = 'pages/view';
    

    It should work. In this case, as you request any page, for example about it will call pages/view/about, where pages is the controller, view is the function and about is the argument that is passed to the function (replacing the default $page = home).

    I also spotted another error in your logic. You wrote

    This works for the “home”-page, but I don’t seem to be able to call views/pages/about for example.

    You don’t have to call view/pages/about. You’ve to call pages/view/about. Remember that the syntax is always the same Controller/Function/Variable1/Variable2/Variable3. So, you should be able to see the about page with http://yourdomain.com/index.php/pages/view/about or only with http://yourdomain.com/about if you have the $route['(:any)'] = pages/view/$1 rules in your routes.php.

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

Sidebar

Related Questions

According to Rob Allen's tutorial : to use a layout into my zend application
I'm new to application development on the iPhone. According to the tutorial, there should
public static class Map extends MapReduceBase implements Mapper MapReduceBase , Mapper and JobConf are
I am doing a tutorial according to this article . This is basic Hello
I was trying to validate an XML signature. The validation according to this tutorial
According to PHP.net manual, pg_pconnect will create a persistent connection, or will return the
I'm a starter in DWR. According to tutorial in (http://directwebremoting.org/dwr-demo/simple/text.html), i placed dwr script
i've done everything according to this tutorial: http://steigert.blogspot.cz/2012/02/1-libgdx-tutorial-introduction.html . Everything compiles fine but after
I have been working through the tutorial by Alex Young on using flash messages
I was watching a Video tutorial according to the author CODE #2 should be

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.