문제

example link upload.php?id=46. I want to disallow all the link ie id=1,2,3 How can I do that using a special character

will this work for me?

disallow:/upload.php?id=*
도움이 되었습니까?

해결책

Your example will work fine for major search engines, but the final * is unnecessary, and will cause the line to be ignored by older robots that don't support wildcards. The Disallow directive basically means "block anything that starts with the following". Putting a wildcard at the end is redundant, and has no effect on what will be matched. Wildcards are not part of the original robots.txt specification, so not all robots support them. All of the major search engines do, but many older robots do not. The following does exactly the same thing as your example, but without wildcards:

User-agent: *
Disallow: /upload.php?id=

다른 팁

Why not just use a header in the upload.php file? I.e. put:

header("X-Robots-Tag: noindex, nofollow", true);

At the top of upload.php. If you're using Apache to serve your files, you can also set up rule based headers in your configuration file.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top