Cherry pick all permanent wp index links stuff.
Merge pull request #1774 from opf/fix/wp-index-permanent-links

Cherry pick all permanent wp index links stuff.