Ad

How To Block A Certain Type Of Urls On Robots.txt Or .htaccess?

- 1 answer

Currently on my webshop, on the category pages with too many pages, the urls end by https://www.example.com?p=2 p=3... I want to tell to the robots.txt to not index urls ending by p=Number. How do I do this? It's a prestashop website by the way.

Thank you all.

Ad

Answer

Just add this line in your robots.txt file:

Disallow: /?p=*

So for example, this would stop URLs like example.com/?p=2 from being indexed by the likes of Google. The * symbol stands for ALL. So anything after p= would be included.

Ad
source: stackoverflow.com
Ad