1

The Drupal 7.59 installation we have a new page for each uploaded image in the files directory. (It's been like this at least since Drupal 7.39 when I joined this project.)

If the image is awesome-photo-by-Robin.jpg, we will get www.ourdomain.com/files/awesome-photo-by-robinjpg. (The missing period before the extension is not a typo.)

The problem is that these pages get indexed by search engines, and because they have no content except header, image and footer, they get very low ranking and clutters our SEO results.

Obviously, these are automatically created during the upload process, where you have no possibility to disable or choose this. However, afterwards, one can go through /admin/content/file and edit the file and voilá, some information appears.

screenshot

Removing the alias doesn't help, since the page remain anyway. (I also cleared the Drupal cache to make sure.)

  1. Can these auto-generated pages be disabled somehow?

  2. If they can't be disabled, we're considering adding Disallow: /files/* to the robots.txt file. Do you think that would work at all to amend this issue, or maybe cause other issues down the road?

  3. What is the actual purpose of these pages?

This is the HTML that's surrounding the IMG tag, maybe it can give you any clues?

<div class="region region-content">
    <div id="block-system-main" class="block block-system">
        <div class="content">
            <div id="file-136" class="file file-image file-image-png">
                <div class="content">
                    <img typeof="foaf:Image" src="https://www.ourdomain.com/sites/default/files/fancy-image.png" width="425" height="282" alt="" />
            </div>
        </div>
    </div>
</div>

2 Answers 2

2

Don't think this is to do with core. Do you have the "File entity" module installed by any chance?

There's a permission of "View files" that anonymous users will have ticked in. If you untick that any of those /files/* will get access denied for annon users

2
  • Yes, we have the "File Entity" module. I disabled "View Files" for Anonymous Users and got a "You are not authorized to access this page." message instead of the image, so the page remains. No real improvement, I'm afraid, as the search engines will find that instead. I've checked the module settings but haven't found anything that seem related to this.
    – LoDef
    Jun 18, 2018 at 9:02
  • Well the improvement is these pages essentially wont get indexed by google because its getting served a 403 unauthorised message but you could also add the robots disallow as mentioned previously. Your further options are: Dont use that module. Or hack that module up to not show it if its really causing you that many problems
    – Leigh
    Jun 18, 2018 at 9:29
0

What is the actual purpose of these pages?

This is not the default behavior of Drupal. So clearly a previous developer created this functionality for some reason. So backup your site before tinkering with it.

Can these auto-generated pages be disabled somehow?

Yes, either it's being created via a custom module, or contrib module, or it's being created via Rules.

So you'll need to disable the module or rule (don't disable the rules module, but the actual rule listed in /admin/config/workflow/rules)

Based on your screen shot, perhaps these pages belong to a content type. So once you disable the module or rule that is creating them, if you found no purpose for them, and want to get rid of them for good, you can delete the content type.

3
  • I have a test environment to work with, so I can pretty much anything without risking the live site :-)
    – LoDef
    Jun 18, 2018 at 9:03
  • We don't have the Rules module. I guess I could go through module by module and see if I can find the culprit (if any). I haven't found anything in any of the Content Types that would produce this.
    – LoDef
    Jun 18, 2018 at 9:17
  • I haven't found anything in any of the Content Types that would produce this. Then I conclude that a custom entity was created then by the file entity module as mentioned in the other answer.
    – No Sssweat
    Jun 19, 2018 at 0:06

Your Answer

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

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