I need to block an entire Drupal 7 site from being indexed for a while. So, I think it is best to redirect everything to 404 instead of actually deleting all my files. How can I do that?

PS: using the following code on .htaccess does not seem to work.

RewriteEngine On
RewriteRule ^ - [R=404,L]

-- Update 03/04/2015 --
The server is nginx

2 Answers 2


If you are just trying to keep it from being indexed, you can just add

User-agent: *
Disallow: /

To the top of your robots.txt

  • This is one of a good option to use for being indexed, but I really need the 404. :(
    – CocoSkin
    Commented Mar 4, 2015 at 13:32
  • since the nginx does not support .htaccess, I'm going to mark this as my answer. Ty @Patrick Ryan
    – CocoSkin
    Commented Mar 4, 2015 at 14:33

You'll need to remove the existing Drupal rewrites for the moment; with them left in the .th access this code won't work.

  • I dont have anything in ".htaccess" beside those 2 lines of code.
    – CocoSkin
    Commented Mar 2, 2015 at 22:08
  • I updated the question. The site is running on nginx, not sure does it really matter.
    – CocoSkin
    Commented Mar 4, 2015 at 13:35
  • If the server is nginx .htaccess has no effect. Commented Mar 4, 2015 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.