Post by supak111 » Mon Feb 24, 2025 1:44 am

What do you guys put into your robots.txt to prevent search engines from indexing:

xxx.com/?tracking=***
AND
xxx.com/?coupon=***

PS I think below works, but I can't really use it because I use /?tracking=** in my google ads and I think this gets my ads disapproved.

Disallow: /*?tracking
Disallow: /*&tracking
Last edited by supak111 on Tue Feb 25, 2025 10:17 pm, edited 1 time in total.

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by nonnedelectari » Mon Feb 24, 2025 10:41 am

supak111 wrote:
Mon Feb 24, 2025 1:44 am
What do you guys put into your robots.txt to prevent search engines from indexing:

xxx.com/?tracking=***
AND
xxx.com/?coupon=***

PS I think below works, but I can't really use it because I use /?tracking=** in my google ads and I think this gets my ads disapproved.

Disallow: /*?tracking
Disallow: /*&tracking
use html meta tags

Code: Select all

<meta name="robots" content="noindex, follow">
and http headers

Code: Select all

header("X-Robots-Tag: noindex, follow", true);
instead.

Active Member

Posts

Joined
Thu Mar 04, 2021 6:34 pm

Post by Elevate » Mon Feb 24, 2025 10:30 pm

Using the headers is tough to do because multiple pages share the same header file.

In robots.txt

User-agent: *
Disallow: /*?tracking
Disallow: /*?coupon

You should also be able to use this if you want to block all URLs that have /? in it
User-agent: *
Disallow: /*?

And then use Google's robots.txt testing tool to make sure:
https://www.google.com/webmasters/tools ... sting-tool

ELEV8TE Website Development
Available for hire - please contact me at https://www.elev8tewebsitedevelopment.com/contact
https://www.elev8tewebsitedevelopment.com


User avatar
Active Member

Posts

Joined
Fri Jul 06, 2018 12:40 am
Location - Denver, Colorado, USA

Post by ADD Creative » Mon Feb 24, 2025 11:24 pm

You can set the noindex in htaccess.

Code: Select all

<If "%{QUERY_STRING} =~ m#(tracking|coupon)=#i">
Header set X-Robots-Tag "noindex"
</If>

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by supak111 » Tue Feb 25, 2025 7:38 am

ADD Creative wrote:
Mon Feb 24, 2025 11:24 pm
You can set the noindex in htaccess.

Code: Select all

<If "%{QUERY_STRING} =~ m#(tracking|coupon)=#i">
Header set X-Robots-Tag "noindex"
</If>
That works great :) thanks!

I tried using FilesMatch but couldn't get it work

.

~ OC 3.0.3.2 and OCmods only ~


User avatar
Active Member

Posts

Joined
Fri Feb 13, 2015 12:09 pm

Post by paulfeakins » Tue Feb 25, 2025 7:18 pm

supak111 wrote:
Tue Feb 25, 2025 7:38 am
That works great :) thanks!
So shall we consider this issue [SOLVED]?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: Mariogs and 82 guests