开发者

Codeigniter 404 error with Google Adwords due to ?gclid=

Using the latest 1.x (1.7.3) version of CodeIgniter, I get 404 errors on gclid from Google Adwords. My understanding is that it's because the "?" in the URL that Google Adwords adds. I've read a bunch of answers online, including here, but I couldn't find anything concrete.

The most common are edit the config file to:

$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = FALSE;

Which solved the gclid problem but kil开发者_开发问答led all my other links. In other words links such as myDomain.com/something/here/there would no longer work.

I've also seen solution that say to edit the .htaccess, but most seem to be workarounds that disable proper tracking by google by just redirecting.

So my question is: What is the proper to allow gclid to go through as well as why is this a good way?


Using the actual latest version of codeigniter, try using...

$config['allow_get_array'] = TRUE;
$config['uri_protocol'] = "AUTO";

which is default in the latest releases, instead of ...

$config['uri_protocol'] = "PATH_INFO";
$config['enable_query_strings'] = TRUE;

which changes your url structure to completely using querystrings instead of segment based urls, which is why your other urls are breaking.

Upgrading information

What's different in Codeigniter 2? (the highlights)

How to upgrade to Codeigniter 2


This did the trick for me

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜