The original robots.txt specification has not defined any wildcards. (However, some parsers, like Google, have added wildcard support anyhow.)
If your concern is that search engines only index one of your two variants, there are alternatives to robots.txt:
You could redirect (with 301) from example.com/page-1271.html
to example.com/page-1271-page-title.html
. This solution would be the best, as now everyone (users, bots) will work with the same URL.
Or you could use the canonical
link relation. On example.com/page-1271.html
(or on both variants) you could add a link
element to the head
:
<link href="example.com/page-1271-page-title.html" rel="canonical" />
This tells search engine bots etc. to use the canonical
URL instead of the current URL.