Jump to content

Help:错误标题

From mediawiki.org
This page is a translated version of the page Help:Bad title and the translation is 86% complete.
Outdated translations are marked like this.
PD 注意:当您编辑本页面时,即同意以CC0协议授权您的贡献。您可以在公有领域帮助页面找到更多信息。 PD

出于各种原因,某些页面标题被定义为错误的标题。 您无法使用这些标题创建页面。

关于如何规定错误标题,请参阅正则表达式段落或者Title.php .

这种标题虽然可用,但强烈不建议使用它们:

  • Some¬`!"£$^&*()_+-=~?/.,;:'@

这些字符无法被用作标题:

HTTP代码

返回的错误代码由MediaWiki软件版本决定:

  • v1.19.1及以后:400 (Bad Request)
  • v1.16.4及以前:200 (OK)

正则表达式

可檢索出標題中無效字元與序列的PCRE2 regex(相對簡單)。 請留意:仍有可能會有沒被檢索到的錯誤標題。

# 匹配的标题将被视为非法。
$rxTc = '/' .
	# 禁止使用任何不允许的字符。
	'[^ %!"$&\'()*,\-.\/0-9:;=?@A-Z\\\\^_`a-z~\x80-\x{10FFFF}+]' .
	# Non-ASCII whitespace, Unicode bidi override characters, the replacement character and noncharacters.
	'|[\xA0\x{1680}\x{180E}\x{2000}-\x{200A}\x{200E}\x{200F}\x{2028}-\x{202F}\x{205F}\x{3000}\x{FFFD}\p{Noncharacter Code Point}]' .
	# 檢索以空格或冒號開頭、或是空白的標題
	'|\A(?:[ :]|\Z)' .
	# Double/closing whitespace.
	'| (?: |\Z)' .
	# URL百分比编码序列会干扰往返标题的功能,从而无法始终如一地链接到它们。
	'|%[0-9A-Fa-f]{2}' .
	# XML/HTML字符引用也会产生类似的问题。
	'|&[A-Za-z0-9\x80-\x{10FFFF}]+;' .
	# Pages with "/./" or "/../" appearing in the URLs will often be unreachable due to the way web browsers deal with 'relative' URLs. Also, they conflict with subpage syntax. Forbid them explicitly.
	'|(?:\A|\/)\.\.?(?:\/|\Z)' .
	# Magic tilde sequences.
	'|~{3}' .
	'/u';

參見