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

The Archive Base Latest Questions

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

I have a database consisting of a table called pages. I have a controller

  • 0

I have a database consisting of a table called “pages”.
I have a controller called “site” and a function called “page”… http://website.com/site/page/page_id.

In the page function it currently looks for the 3th URI segment (page_id), then finds and matches this to a page row in the database and displays the row results.

My question is, is it possible to route/change my URL from http://website.com/site/page/page_id to
http://website.com/page_id. And then obviously change my function to find the first URI segment??

My current .htaccess file removes the “index.php”, and looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /db

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#‘system’ can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn’t true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#This last condition enables access to the images and css folders, and the robots.txt file
#Submitted by Michael Radlmaier (mradlmaier)
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don’t have mod_rewrite installed, all 404’s
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule>
  • 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-24T18:38:17+00:00Added an answer on May 24, 2026 at 6:38 pm

    Take a look at this article. Editing the routes.php in your application config should do the trick. Something like this should work:

    $route['(:any)'] = 'site/page/$1';
    

    If you use additional controllers, however, more work might be necessary (I assume “site” is your controller, i.e. site.php is located in application/controllers).

    In the code, you might also consider using :num instead of :any if your page IDs are only numeric.

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

Sidebar

Related Questions

Scenario I have a database consisting of a table called Problems which in turn
I have a Sqlite database that has a table consisting of company information (Companies)
I have a table consisting 10 columns in database. One of the columns have
I have a database table consisting of countries. In my DAO which extends HibernateDAOSupport
I have a database table consisting of strings... I need to search for a
I have the following database table consisting of a series of tasks: id BIGINT
I am currently working on restructuring my site's database. As the schema I have
I have a table called emaildata consisting of 4 columns emailaddress, domainname, data and
I have database with many tables. In the first table, I have a field
i have database table like this +-------+--------------+----------+ | id | ip | date |

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.