EllisLab text mark
Advanced Search
     
URL with query string (google tracking) is causing a 404 to be shown.
Posted: 12 October 2011 09:32 PM
Joined: 2009-08-28
102 posts

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:

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 

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

 
Posted: 13 October 2011 10:14 AM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-15
12649 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

 

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors

 
Posted: 13 October 2011 03:49 PM   [ # 2 ]   [ Rating: 0 ]
Joined: 2009-08-28
102 posts

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!

 
Posted: 14 October 2011 11:20 AM   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2006-04-15
12649 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

 Signature 

Shopping Cart Plugin | Full List Of Add-Ons | About Me
——————————————————————————————
2.x Bug Tracker | Upgrade Errors