how to stop http urls from indexing?

55 Views Asked by At

I want to block http urls from indexing ,I want https urls only be indexed by googlebots,

I have tried this code in htaccess file but its not working[blocking

#blocking http urls from indexing
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^robots.txt$ robots-deny-all.txt [L]

I wrote this code inside robots-deny-all.txt

User-agent: *
Disallow: /

appreciate your help

1

There are 1 best solutions below

1
FARIS ISMAIL On

only you have to wait for one week to see result , the code works well

in case you wanted to block https replace 80 by 443