禁止多个目录的公共子页面,同时允许目录本身

问题描述 投票:0回答:1

我有以下结构

http://example.com/universities/UNIVERSITY_ID/review

我试图禁止评论页面,但保留动态的 UNIVERSITY_ID 页面。

我怎样才能在

robots.txt
中实现这一点?

这行得通吗?

Disallow: /universities/*/review
url robots.txt
1个回答
0
投票

使用通配符是解决此问题的更好解决方案。

User-agent: *
disallow: /*review$

参考:https://webmasters.stackexchange.com/questions/72722/can-we-use-regex-in-robots-txt-file-to-block-urls

© www.soinside.com 2019 - 2024. All rights reserved.