0

I am currently doing this with htaccess

RewriteRule ^view$ view.php [L]

And I link to /view without the extension and it works fine. But how do I disable robots from indexing /view? in the robots.txt I put

Disallow: /view.php
Disallow: /view

When I go into webmaster tools and I fetch as google. I can fetch the mydomain.com/view, which is not suppose to happen, but when I try to fetch mydomain.com/view.php it says blocked by robots.txt, which is good.

How can I block access to /view from robots?

ramo
  • 945
  • 4
  • 12
  • 20

1 Answers1

0

The line

Disallow: /view

should block URLs like:

  • example.com/view
  • example.com/view/
  • example.com/view/foobar
  • example.com/view.php
  • example.com/viewer

As you see, you wouldn't need Disallow: /view.php at all.

So there seems to be a different problem. Was this a recent change? Maybe Google cached an older variant of your robots.txt. I don't know this fetching tool, but maybe the problem is related to the redirect? I'd guess that the Google fetching tool should be redirected to /view.php.

unor
  • 92,415
  • 26
  • 211
  • 360