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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:27:42+00:00 2026-05-16T00:27:42+00:00

I am having difficulty with code igniter routing. http://www.mysite.com goes to the right controller

  • 0

I am having difficulty with code igniter routing.

http://www.mysite.com goes to the right controller and does the right thing. However, http://www.mysite.com/?ref=p&t2=455 causes a 404 error. Also http://www.mysite.com/mycontroller/mymethod/?ref=p&t2=455 works fine.

I changed the uri_protocol in the config.php file and tried different values. Auto seems to work the best.

My theory is that code igniter is using the query parameters to do the routing. The problem is that these query parameter have nothing to do with routing.

How do I tell code igniter to ignore query parameters for the default controller?

Note, I followed the instructions online to remove the index.php from the URL. I dont think its causing a problem, but here is my .htaccess file just in case:

RewriteEngine On
RewriteBase /~trifecta/prod/

#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]
  • 1 1 Answer
  • 3 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-16T00:27:43+00:00Added an answer on May 16, 2026 at 12:27 am

    With that rewrite rule RewriteRule ^(.*)$ /index.php?/$1, here are some examples of rewrites that are occuring:

    http://www.mysite.com =>
    http://www.mysite.com/index.php?/ (actually, this might not be being rewritten at all)

    http://www.mysite.com/mycontroller/mymethod/?ref=p&t2=455 =>
    http://www.mysite.com/index.php?/mycontroller/mymethod/?ref=p&t2=455

    http://www.mysite.com/?ref=p&ts=455 =>
    http://www.mysite.com/index.php?/?ref=p&t2=455

    The first one will work whether it is being rewritten or not. CodeIgniter is processing either an empty query string (which is easy) or a query string of simply “/”.

    The second one (which also works) is being rewritten, but CodeIgniter is able to process its query string, which is /mycontroller/mymethod/?ref=p&t2=455. CI turns that into an array of segments as

    [0] => mycontroller
    [1] => mymethod
    [2] => ?ref=p&t2=455
    

    Array index 2 ultimately gets ignored by anything you’re doing.

    The third one (which does not work is being rewritten, and CodeIgniter can’t process its query string at all. Its query string is rewritten to: /?ref=p&t2=455. That makes for an array of segments that looks like this:

    [0] => ?ref=p&t2=455
    

    which doesn’t match any controller on your site.

    Probably, you’ll fix the whole thing by modifying the RewriteRule from
    RewriteRule ^(.*)$ /index.php?/$1 to
    RewriteRule ^(.*)$ /index.php/$1
    at which point you’d probably want to change the uri_protocol config back to PATH_INFO.

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

Sidebar

Ask A Question

Stats

  • Questions 537k
  • Answers 537k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It can't optimise them out because you have declared the… May 17, 2026 at 1:34 am
  • Editorial Team
    Editorial Team added an answer Any variable used inside a block is const copied. So… May 17, 2026 at 1:34 am
  • Editorial Team
    Editorial Team added an answer SHOW TABLE STATUS shows information about a table, including the… May 17, 2026 at 1:34 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am having difficulty connecting my java code to sql server database. I can
I am having difficulty with the following code which is inside a static method
I have adjusted my code slightly but I am still having difficulty posting it
I am having difficulty writing my code in the way it should be written.
I'm working in Ada95, and I'm having difficulty figuring out pointers. I have code
I am having difficulty trying to get modernizer to run with codeigniter. this is
I am having difficulty getting my head around memory management in the following segment
I am having difficulty in my Qt program with connecting button signals to my
I'm having difficulty with setting up a second sidebar for my Wordpress theme. Here's
In PHP I am having difficulty trying to extract row data from one SQL

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.