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.

Remove ? from url

August 23, 2010 2:45am

Subscribe [4]
  • #1 / Aug 23, 2010 2:45am

    Bell Design

    42 posts

    Another issue I have been having with EE 1.6.8 this weekend is that the removing of index.php and the ? from the url as well.

    I am on a Godaddy Linux Shared hosting setup have done the following:

    1.  Removed index.php from “name of my sites index page” under General Configuration

    2.  In Output and Debugging Preferences, I have “Force URL query strings” checked to “yes”

    3.  Cleared my system/cache folder of everything but index file and set permissions to “777”

    3.  I also have a htaccess file on my server with the following:

    RewriteEngine on
    RewriteCond %{QUERY_STRING} ^(css=.*)$ [NC]
    RewriteRule ^(.*)$ /index.php?/%1 [L]
    RewriteCond $1 !^(images|system|themes|favicon\.ico|index\.php?) [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    Which of course is using the exclude method.

    Issue is that the index.php is removed but the ? in the url is still there.  I know it is being put there via the Output/Debugging and thought that is what the htaccess file fixed.

    I have used this same method on another Godaddy Linux Shared Hosting setup and it worked fine.

    EE is installed in a sub-directory for that is where the website using EE is located.  The working example was also in a sub-directory.

    Also, I placed a php5.ini file in my main website directory as the other example that included this:

    cgi.fix_pathinfo=1

    What am I missing or doing wrong? 


    ps:  i have tried the following methods as well:
    http://expressionengine.com/wiki/Workaround_for_Forced_Query_Strings/
    http://ellislab.com/forums/viewthread/74436/

    Tried those before and they didnt work.  That is until the step above worked fine for me

  • #2 / Aug 23, 2010 4:29am

    Ingmar

    29245 posts

    In Output and Debugging Preferences, I have “Force URL query strings” checked to “yes”

    That is the problem. What this setting does is to insert a question mark into all of your links. If you don’t want this to show publicly, ie if you are removing index.php from your links you should turn it off and insert that question mark via htaccess (invisibly, as it were).

    Like all server side rewrite issues we can’t support this officially, though, so I am going to move this to the CodeShare Corner. Thanks!

  • #3 / Aug 23, 2010 11:59am

    Bell Design

    42 posts

    That is what is confusing is that the Output/Debugging was turned on in the last install and with the htaccess file there was no ? or index.php

    Also, when I upload that htaccess file to the server, my website breaks, in that the css doesn’t work.

  • #4 / Aug 25, 2010 2:05am

    Focus Lab Dev Team

    1129 posts

    This might not be the solution you’re looking for but it might be worth a try.

    I’ve been experimenting with multiple server environments and the whole query string vs path info thing. What I’ve come up with is a way to (potentially) not have to use the query string approach on any sites. It involves a small addition to the core index.php file so it’s unquestionably not going to be supported by EllisLab (and rightly so).

    Add a file to the same directory as your index.php file and name it force_path_info.php. Then paste this into it for the contents:

    <?php
    if ( ! isset($_SERVER['PATH_INFO']) || $_SERVER['PATH_INFO'] == '')
    {
       $rq = $_SERVER['REQUEST_URI'];
       $index = ltrim($_SERVER['SCRIPT_NAME'],'/');
       if (strlen($rq) > 1 && $rq !== '/'.$index)
       {
          if (strpos($rq,'?'))
          {
             $rq = explode('?',$rq);
             $rq = $rq[0];
          }
       
          $_SERVER['PATH_INFO'] = (strpos($rq,$index) !== FALSE) ? str_replace('/'.$index,'',$rq) : $rq ;
       }
    }
    ?>

    Then open your index.php file and look around line 27 for

    $qtype = 0;

    Immediately after that line insert this:

    include $_SERVER['DOCUMENT_ROOT'].'/force_path_info.php';

    That will call the script we just added.

    Then alter your htaccess to NOT include the question mark and make sure you have Force Query Strings turned OFF.

    Try loading your site and pages now. Any luck?

  • #5 / Nov 29, 2010 4:38pm

    Paul Bell

    104 posts

    Just tried this - seems to have worked helping our site to pick up query strings.

  • #6 / Nov 29, 2010 4:43pm

    Focus Lab Dev Team

    1129 posts

    Just tried this - seems to have worked helping our site to pick up query strings.

    That’s great. Glad it has helped you as well 😊

  • #7 / Mar 06, 2011 12:55pm

    vlad

    213 posts

    Hello Dear EE gurus,
    Help me out here, I have the same problem,

    BUT i dont understand:
    “Then alter your htaccess to NOT include the question mark “

    This is my .htacess

    RewriteEngine On
    
    # ditch the ?
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /?/$1

    How do I get rid of the ?...

    Thanks in advance!

  • #8 / Mar 06, 2011 8:45pm

    Focus Lab Dev Team

    1129 posts

    Which version of EE are you using? This particular method of ours was for EE1 and isn’t really needed in EE2 anymore.

  • #9 / Mar 06, 2011 10:43pm

    vlad

    213 posts

    v2.1.3 Build:  20101220
    Is there anything for EE2, besides asking the client to dump go daddy?
    😊

    Thanks!
    V

  • #10 / Mar 07, 2011 11:26am

    Focus Lab Dev Team

    1129 posts

    You can experiment with the $config[‘uri_protocol’] setting in config.php. Go through the options commented out above it and test your site each time to see if the pages load properly.

  • #11 / Mar 07, 2011 12:20pm

    vlad

    213 posts

    I just switched servers… I hate goDaddy.

  • #12 / Mar 07, 2011 12:54pm

    Focus Lab Dev Team

    1129 posts

    Haha. perfect 😊

  • #13 / Mar 07, 2011 2:46pm

    vlad

    213 posts

    I rather waste a day rebuilding the whole site than dealing with them ever again.

    The site was constantly going down, and kicking me out of the CMS. This is aside from the /?/ issue and the mail form issues they have…

    I called their CS and the guy told me its all Okie DOkie on their end… I said can you try to load the site, he said something along the lines well it must be EE then.

    Right. I build over a dozen sites with EE and only had this issue one other time… with another client who used a goDaddy server. That’s what you get for $5.99 a month.

    >:L

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

ExpressionEngine News!

#eecms, #events, #releases