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.

Can't see $_GET variables

October 31, 2009 10:20am

Subscribe [2]
  • #1 / Oct 31, 2009 10:20am

    Greg Stewart

    8 posts

    I am having trouble with $_GET variables.

    I turned on PHP for one of my templates and added <? print_r($_GET) ?> to output all GETs, and this what I get:

    mydomain.com/about/?foo=bar => Array ( [about/] => ) 

    I also turned on “display template debugging” and it says:
    URI: /about/

    It seems to me the GET isn’t read out or something.

    It seems to be related to my .htaccess and I found some information about this here and tried their suggestions but it made my site inaccessible:
    http://ellislab.com/forums/viewthread/128374/#641072

    I am hosting on dreamhost and this is my .htaccess file:

    RewriteEngine on
    RewriteCond $1 !^(assets|themes|images|system|robots\.txt|favicon\.ico|index\.php)
    RewriteRule ^(.+)$ index.php?$1 [L]

    Any idea what’s going on?

    Greg

  • #2 / Oct 31, 2009 3:21pm

    Greg Salt

    3988 posts

    Hi Greg,

    We don’t support the removal of index.php using .htaccess since it does not affect the use of ExpressionEngine. ExpressionEngine does not destroy the $_GET global. However, it looks like your RewriteRule might be causing the issue. Try changing it from this:

    RewriteEngine on
    RewriteCond $1 !^(assets|themes|images|system|robots\.txt|favicon\.ico|index\.php)
    RewriteRule ^(.+)$ index.php?$1 [L]

    to this:

    RewriteEngine on
    RewriteCond $1 !^(assets|themes|images|system|robots\.txt|favicon\.ico|index\.php)
    RewriteRule ^(.+)$ index.php?/$1 [L]

    In addition, ExpressionEngine does provide a method of accessing globals in a safe way. Please have a look at the development documentation for the input class

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases