Here is my problem:
example.com/images folder and subfolders contain all of my images for example.com site and sub pages.

Google is indexing those directories locations as URLs. For example.

  • /images
  • /images/promotions
  • /images/products

All are indexed by Google. I understand they are generated by apache but they are not intended to be URLs for humans.

I don't have .htaccess control as we are on Yahoo web hosting (I know). I can't use robot.txt to block use the entire directories as that will block the actual image assets.

Anyone have a smart workaround for me? Should I create /images/index.html and redirect it to the homepage? I hate to create a bunch of empty useless pages. I submitted to Google Webmaster URL removals but I am afraid someone else is linking to these directories and it will just cause it to get indexed again.

In the meantime, google mobility usability is giving me a low grade. People are having access to all of my image assets (well at least easier access to them).

  • I would normally tell you to make sure that -Index was in your configuration, but since you do not have access to even .htaccess, I think I would go another route. See if you get a directory index when you go to example.com/images/. If you do, switch hosts fast!! ;-) Otherwise, you can create a default web page (index.php) in these directories that do a 301 redirect to your home page using PHP code. I will let someone who knows PHP answer.
    – closetnoc
    Sep 8, 2015 at 17:32

1 Answer 1


Should I create /images/index.html

If these are literally directory index pages that are being auto generated (and you don't have access to .htaccess) then yes, you'll need to create an index document in these directories. Either index.html or index.php if that works for you.

and redirect it to the homepage?

However, I would not redirect it to the homepage. (I can't believe you would be getting much real/meaningful traffic to these pages, apart from bots and people trying to steal your images en masse?)

Ideally you should send a 410 Gone in order to get these URLs removed from Google's index. In PHP:

header($_SERVER['SERVER_PROTOCOL'].' 410 Gone',true,410);

Or, if you can't send custom headers, then simply a soft-404 would be a "make do" (ie. a page that simply states "Not Found", but returns a 200 OK status) - it's unlikely to appear in search results, and contains nothing meaningful if it does. Or even just a blank page!?

  • See! I knew someone would have a better answer!! Good advice not redirecting. It is a viable option, but your 410 is a far better solution. I did not get any sleep last night so I was not firing on all 3.237 cylinders.
    – closetnoc
    Sep 8, 2015 at 20:31
  • Thanks w3d. Good point about redirecting NOT redirecting it.
    – David
    Sep 13, 2015 at 21:12

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.