![]() |
Root URL dies 404 if query string (?) is present - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Root URL dies 404 if query string (?) is present (/showthread.php?tid=19355) |
Root URL dies 404 if query string (?) is present - El Forum - 06-04-2009 [eluser]the_nix[/eluser] My sub pages work fine: Code: http://www.example.com/controller/method?var=the_GET_vars_are_ignored_as_expected However the home page dies 404 if a query string is present Code: http://www.example.com/?var=this_causes_404_error I do not need the information that is contained in those query tags so any solutions that just strips them off is fine. I can't just change the inbound links because they are legacy URLs from external sites. Copy of my .htaccess file: Code: <IfModule mod_rewrite.c> Thanks! Root URL dies 404 if query string (?) is present - El Forum - 06-04-2009 [eluser]slowgary[/eluser] CI doesn't like query strings. It destroys the $_GET array by default, and throws an error when it gets query strings. Whether or not you're using the query strings, you should avoid having any links pointing to your site with query strings otherwise this will happen. There's a config item in application/config.php that will enable query strings to avoid this problem. Root URL dies 404 if query string (?) is present - El Forum - 06-04-2009 [eluser]Thorpe Obazee[/eluser] Try playing the uri protocols in the config. I think PATH_INFO should work. Root URL dies 404 if query string (?) is present - El Forum - 06-04-2009 [eluser]Colin Williams[/eluser] This line "RewriteRule ^(.*)$ /index.php?/$1 [L]" is odd, but I see it a lot. Why "?/" and not just "/"? Root URL dies 404 if query string (?) is present - El Forum - 06-05-2009 [eluser]the_nix[/eluser] I replaced this line: Code: RewriteRule ^(.*)$ /index.php?/$1 [L] with: Code: RewriteRule ^(.*)$ /index.php/$1 [L] but now both the root domain as well as but sub pages with an explicit ? in the string die 404. It appears the trailing ? in the .htaccess allows CI to ignore the extra query string GET variables (that's what I want) but it's just not working on the root page e.g., Code: http://www.example.com/?var=causing404error Any other ideas? Root URL dies 404 if query string (?) is present - El Forum - 06-06-2009 [eluser]the_nix[/eluser] PS - I tried setting the URI_PROTOCOL to each of the four options. One succeeded in ignoring trailing ?var=causingproblems but then only my home page would load (it was ignoring my path). The other three did not help. Root URL dies 404 if query string (?) is present - El Forum - 06-06-2009 [eluser]TheFuzzy0ne[/eluser] Try changing lines similar to this: Code: RewriteRule ^(.*)$ /index.php?/$1 [L] to this: Code: RewriteRule ^(.*)$ /index.php?/$1 [QSA,L] Root URL dies 404 if query string (?) is present - El Forum - 07-30-2009 [eluser]Matthew Pennell[/eluser] [quote author="TheFuzzy0ne" date="1244312495"]Try changing lines similar to this: Code: RewriteRule ^(.*)$ /index.php?/$1 [L] to this: Code: RewriteRule ^(.*)$ /index.php?/$1 [QSA,L] Has anyone solved this issue yet? The above suggestion didn't help me - I have a similar issue trying to track paid search that appends a querystring parameter to my homepage. The page just dies. There must be a way to fix it, because the EE site works fine with querystrings. Root URL dies 404 if query string (?) is present - El Forum - 07-30-2009 [eluser]Matthew Pennell[/eluser] Actually, this page by LG looks like a potential solution, albeit a little hacky. Root URL dies 404 if query string (?) is present - El Forum - 08-20-2009 [eluser]darri[/eluser] I was looking for a way to make CI ignore a query string that paypal was sending it, and using this worked for me: RewriteRule ^(.*)$ /index.php?/$1 [L] Thanks! |