//Keep Google & MailChimp in check

MailChimp & Google campaigns breaking your EE pages? Here's our .htaccess solution.

If you are using a jQuery/JavaScript effects on your website and running PHP, visitors who clicked on a Google AdWords or MailChimp email campaign link to get to your site may see broken pages.

This is due to the long strings that both services add to the URL, and throws a monkey(!) wrench to your jQuery effects. To make sure your site keeps looking beautiful, be sure to add the lines (shown to the right) to your .htaccess file:

# Catch any Mail Chimp campaigns directed to the home page
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^(utm_source=.*)
RewriteRule ^(.*)$ /index.php?/ [L,PT]

# Catch any Google campaigns directed to the home page 
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^(gclid=.*)
RewriteRule ^(.*)$ /index.php?/ [L,PT]

For those of you new to .htaccess files: to create one, simply open a new text file in Notepad, and copy and paste in the code above. To save with the proper file name (Notepad adds .txt extension automatically), simply add double quotes to the name and save, as shown below.

May all of your Google & MailChimp campaigns be homeruns, and don't forget to send questions and suggestions to learn@creat-ee.com!

blog comments powered by Disqus