A Google Analytics query string on an incoming link breaks the display of my site.
Does anyone know why the following would cause my site to fail to load its homepage properly (it appears to prevent the loading of some plugins that the page needs)
http://mysite.com/?utm_medium=email
While this does not:
http://mysite.com/#utm_medium=email
And if you know why, how do I fix this? I have incoming links that use the query string method and they are all resulting in the visitor seeing a broken homepage.
The site uses "pretty urls" so there are no query strings needed for the site routing. I tried simply removing the query string via apache rewrite (which is easy to do and works, I give an example below) but then I assume Google Analytics won't be able to track what it needs if I do this.
Here is my .htaccess
in case that factors into it:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Handle redirection from https to http
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301]
# Example of what would strip query strings from url
#RewriteCond %{THE_REQUEST} \?[^\ ]+
#RewriteRule (.*) /$1? [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Extra
In addition to @faa's solution and incorporating @Eduardo's bit into this I also needed to exclude the admin directory from being affected. I did this by adding:
RewriteCond %{REQUEST_URI} !^\/*(wp-admin)