简体   繁体   中英

Is there a universal algorithm for permalinks? (human-readable)

I'm trying to make a blog script from scratch (PHP) and import posts from Wordpress. I need to use the exact same permalink algorithm as Wordpress because I want to keep the URLs same. (and just in case I need to go back to Wordpress)

The custom structure is /%postname%/. I noticed that special characters (such as * - /) and unicode characters are ignored, and if it's a duplicate, a number is automatically added at the end. Is that all I need to know?

Thanks.

你需要看的Wordpress函数是wp-includes/formatting.php sanitize_title_with_dashes

WordPress has defaults, but those defaults may change from version to version. Plus WordPress also lets you customize the permalinks, so I don't think you'll find a "universal" structure.

With that in mind though, here's an article on URL Design that might be helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM