ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Misc query variable causes 404 redirect

March 16, 2010 9:34pm

Subscribe [2]
  • #1 / Mar 16, 2010 9:34pm

    eddit

    11 posts

    Sure there is an easy answer but my searches return no relevant results…
    Looking to pass in a variable (grid) to any page which php will pickup and either load/not load a stylesheet.

    http://www.domain.com/?grid=1
    http://www.domain.com/template_group/?grid=1
    http://www.domain.com/template_group/entry/?grid=1

    Any ideas? My goal is to show or hide a grid graphic identical to StopDesign:

    http://stopdesign.com/
    http://stopdesign.com/?g=1

    All I get is a generic 404 redirect, not the 404 template I have specified in the template preferences.

    My .htaccess has this:

    # include method to remove index.php
    RewriteEngine on 
    RewriteCond $1 ^(404|work|notebook|about|shop|rss|P[0-9]{2,8}) [NC] 
    RewriteRule ^(.*)$ /index.php?/$1 [L]
  • #2 / Mar 17, 2010 1:27am

    Gareth Davies

    491 posts

    To be sure it’s a .htaccess issue I assume it works if you use http://www.domain.com/index.php?grid=1

    Also, not sure but do you have an unneeded ? in the RewriteRule i.e. RewriteRule ^(.*)$ /index.php/$1 [L]

  • #3 / Mar 17, 2010 1:40am

    eddit

    11 posts

    Unfortunately no dice.

    http://www.domain.com/index.php?grid=1 routes to the 404 page but does process the grid variable and loads the grid stylesheet.

    Below is the php code to detect for the grid variable, just incase that helps any:

    <?php if(isset($_REQUEST["grid"])){ ?>
    <link rel="stylesheet" type="text/css" media="screen" href="/css/grid.css" />
    <?php } ?>

    I also have “Enable Strict Urls” set to “yes” with my 404 page as the index of a 404 template group.

    In reference to the additional ? in my .htaccess, I found that it solved the path_info variable issue on my host. Without it I get “No input file specified.” when accessing any of my template groups in the url.

    Any ideas?

  • #4 / Mar 17, 2010 1:50am

    Gareth Davies

    491 posts

    You can load the index page by going to http://www.domain.com/index.php right? You don’t have the 404 template group as the default group?

    I’d suggest clearing the .htaccess and getting it to work like that, then add the rules back as there’s nothing wrong with that PHP.

  • #5 / Mar 17, 2010 11:05am

    eddit

    11 posts

    Yes http://www.domain.com/index.php does load the home page. I have a template group “home” with the index.php of that template group as the index of the site.

    What do you mean by “clearing the .htaccess and getting it to work like that”? If i empty the .htaccess I still get a 404 route if I go to:

    http://www.domain.com/index.php?grid=1

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases