.htaccess code to discourage search engines from indexing your website

For some reasons you might need to discourage search engines from indexing your website, most times if your website is still in development stage.

Using a robots.txt is no longer advised, according to this yoast article so using htaccess might just be what you need.

I will assume you know your way around creating a htaccess file or editing it if it already exists.

so just add these lines in your htaccess file.

<IfModule mod_headers.c>
Header set X-Robots-Tag "noindex, nofollow, noarchive"
<FilesMatch "\.(doc|pdf|png|jpe?g|gif)$">
Header set X-Robots-Tag "noindex, noarchive, nosnippet"



Previous articleExplanation of Networks and Packets
John Onyejegbu
John Loves to code!!! He loves engaging in challenging tasks, identifying problems in our society and using technology to solve those problems!!! I am a strong software developer with an extensive background in all part of the software development lifecycle. My unique career has given me Experience in not only development, but project management, database design and management, software testing, quality assurance, and disaster recovery planning.