Jump to content

Edit History

Smokovsky

Smokovsky


added tags

Hey! I'm having a hard time with urls in my prestashop. I have installed multishop, prettyUrls and now I'm facing a big problem. When clicked Google Ad or Facebook link with my website it comes with mydomain.com/index.php?controller=404. I found that Facebook and Google are adding parameters to links, like mydomain.com/?fbclid=123, /?gclid=123.

I worked around this problem with .htaccess:

RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)fbclid=(?:[^&]*)((?:&|$).*)$ [NC]
RewriteCond %1%2 (^|&)([^&].*|$)
RewriteRule ^(.*) /$1?%2 [R=301,L]

RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)gclid=(?:[^&]*)((?:&|$).*)$ [NC]
RewriteCond %1%2 (^|&)([^&].*|$)
RewriteRule ^(.*) /$1?%2 [R=301,L]

And it is not only those two parameters, any parameter with question mark would lead to 404, like: mydomain.com/?anything

Anyways now Google is crying that my gclid parameter was modified or deleted.
So how to do it right? 

Smokovsky

Smokovsky

Hey! I'm having a hard time with urls in my prestashop. I have installed multishop, prettyUrls and now I'm facing a big problem. When clicked Google Ad or Facebook link with my website it comes with mydomain.com/index.php?controller=404. I found that Facebook and Google are adding parameters to links, like mydomain.com/?fbclid=123, /?gclid=123.

I worked around this problem with .htaccess:

RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)fbclid=(?:[^&]*)((?:&|$).*)$ [NC]
RewriteCond %1%2 (^|&)([^&].*|$)
RewriteRule ^(.*) /$1?%2 [R=301,L]

RewriteBase /
RewriteCond %{QUERY_STRING} ^(.*)(?:^|&)gclid=(?:[^&]*)((?:&|$).*)$ [NC]
RewriteCond %1%2 (^|&)([^&].*|$)
RewriteRule ^(.*) /$1?%2 [R=301,L]

And it is not only those two parameters, any parameter with question mark would lead to 404, like: mydomain.com/?anything

Anyways now Google is crying that my gclid parameter was modified or deleted.
So how to do it right? 

×
×
  • Create New...