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.

URL with query string (google tracking) is causing a 404 to be shown.

October 12, 2011 9:32pm

Subscribe [2]
  • #1 / Oct 12, 2011 9:32pm

    Hi there,
    I’ve just launched a new Campaign Monitor template for a client of mine and when clicking links from within the newsletter the Google Analytics query strings are being appended to the string as expected.

    Unexpectedly however my site won’t load it’s homepage, instead it loads the 404 template.

    My EE build is 2.1.3 with MSM (2 sites).

    Here is the URL that should load: http://example.com/site1/ (and http://example.com/site2/ ยป MSM)

    The URL causing the 404 is this:

    <a href="http://example.com/site1/?utm_medium=email&utm_campaign=Template+Preview&utm_content=Template+Preview+CID_0167b39f3d7c8c91dc4f50e175068f71&utm_source=Demand++Email+marketing+by+Supply&utm_term=Check+out+the+Resort">http://example.com/site1/?utm_medium=email&utm_campaign=Template+Preview&utm_content=Template+Preview+CID_0167b39f3d7c8c91dc4f50e175068f71&utm_source=Demand++Email+marketing+by+Supply&utm_term=Check+out+the+Resort</a>

    The template that is being loaded for the http://example.com/site1/ URL is at “/site1/content/index/” (site/tmplgrp/file).

    I have read through a bunch of forum posts but cannot figure out how to place the correct htaccess redirect methods and apply it to the MSM sites.

    My current htaccess redirects are these:

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
    
    # Remove www.
      RewriteCond %{HTTPS} !=on
      RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
      RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
    # Append trailing /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
      RewriteRule ^(.*)$ /$1/ [R=301,L]
    
      # never rewrite for existing files, directories and links
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-l
    
      # rewrite everything else to index.php
      RewriteRule ^(.*)$ index.php/$1 [L]
    
    </IfModule>

    Lastly, following things read around the forum, I have tried adding this block to the mod rewrite block but this didn’t help either:

    RewriteCond %{QUERY_STRING} ^utm_source
    RewriteCond %{REQUEST_URI} ^/site1/$ [NC]
    RewriteRule (.*) /index.php?/site1/content/index/&%{QUERY_STRING} [L]

    Any help would be much appreciated.

    Thanks,
    Jannis

  • #2 / Oct 13, 2011 10:14am

    Mark Bowen's avatar

    Mark Bowen

    12637 posts

    Hi Jannis,

    I’m afraid we can only give support for .htaccess issues if you are using the code that we supply in our documentation here.

    That aside though if you check your system > expressionengine > config > config.php file and check the line that should say :

    $config['uri_protocol'] = 'AUTO';

    If you try changing that to :

    $config['uri_protocol'] = 'PATH_INFO';

    Does that enable your code to then work?

    Thanks,

    Mark

     

  • #3 / Oct 13, 2011 3:49pm

    Hi Mark,

    I changed my htaccess file to reflect the documentation you provided me a link to.
    This by itself didn’t help unfortunately.

    Your second suggestion however, changing the uri_protocol to PATH_INFO worked nicely.

    Does switching this variable to PATH_INFO have any other implications whatsoever that I need to know about?

    Thanks for your help!

  • #4 / Oct 14, 2011 11:20am

    Mark Bowen's avatar

    Mark Bowen

    12637 posts

    Hi Jannis,

    Excellent. Glad that got you sorted now.

    This setting is just because some servers work in different ways and so this is provided in order to allow ExpressionEngine to work on those servers.

    I don’t believe that anything can go wrong or there are any other implications at all though. If you do have a problem though down the road then please don’t hesitate to create a new thread and we’ll deal with it as soon as we can.

    Thanks,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases