announcing mdoc.su, short manual page URLs

Constantine A. Murenin cnst++ at FreeBSD.org
Tue Feb 19 08:27:03 UTC 2013


Dear freebsd-{chat,current,doc}@,
I would like to announce and introduce <URL:http://mdoc.su/>, 
a deterministic URL shortener for BSD manual pages, 
written entirely in nginx.conf.
It supports several address schemes, for example:
http://mdoc.su/f/zfs
http://mdoc.su/f/zfs.8
http://mdoc.su/f/8/zfs
http://mdoc.su/freebsd/zfs
http://mdoc.su/FreeBSD/zfs
http://mdoc.su/d/hammer.5
http://mdoc.su/d/hammer.8
etc.
Source code for the whole mdoc.su.nginx.conf is available at:
 https://github.com/cnst/mdoc.su
 https://bitbucket.org/cnst/mdoc.su
Specifically, the following currently controls FreeBSD rewriting:
	location /FreeBSD {	rewrite	^/FreeBSD(/.*)?$	/f1ドル;	}
	location /f {
		set	$fb	"http://www.freebsd.org/cgi/man.cgi?query=";
		set	$fs	"&sektion=";
		rewrite	^/freebsd(/.*)?$	/.1ドル;
		rewrite	^/./([^/.]+)/([^/]+)$		$fb2ドル$fs1ドル	redirect;
		rewrite	^/./([^/]+)\.([1-9])$		$fb1ドル$fs2ドル	redirect;
		rewrite	^/./([^/]+)$			$fb1ドル$fs	redirect;
		rewrite	^/./?$	/	last;
		return	404;
	}
Translation: "/FreeBSD" and "/freebsd" get rewritten to "/f" internally, 
without any extra replies to the user, and then the rest of the URI is 
analysed, and a "302 Found" redirect is finally issued to the user.
Pages like http://mdoc.su/f/ redirect to the main "/" page internally, 
without affecting the URL that's visible to the user, making it easier 
to keep a starting page specifically for one BSD.
Questions, comments and suggestions are very welcome. 
Available through IPv4 and IPv6. 
Enjoy!
Best regards,
Constantine.


More information about the freebsd-doc mailing list

AltStyle によって変換されたページ (->オリジナル) /