Changing Blog Post URLs Programmatically in Sitefinity
When migrating legacy Sitefinity sites, old .aspx URLs often stick around. Here’s how to regenerate all your blog post slugs programmatically using the Sitefinity API — fast, safe, and consistent.

When migrating older Sitefinity projects, it’s not uncommon to end up with legacy URL structures — especially when moving from Sitefinity 3.x to 4.x and beyond.
Back in the day, Sitefinity 3.x used .aspx
extensions for content URLs, while later versions dropped that convention. If you’ve migrated content and noticed that your blog posts still hold onto the old URLs, you can regenerate them in bulk with a few lines of code.
The example below uses the BlogsManager
API to loop through all blog posts, clear the existing URL mappings, and rebuild them based on the post title.
How It Works
- Get all master blog posts using
BlogsManager.GetManager()
. - Check out each post so it can be modified.
- Clear existing URLs and set a new
UrlName
based on the post title. - Recompile and validate the URLs using
RecompileAndValidateUrls()
. - Publish and save each post to apply the changes.
The regex ensures that your new URLs are lowercase and stripped of special characters, replacing them with dashes for consistency.
After running the script, all blog post URLs are instantly refreshed — removing the old .aspx
extensions and giving you clean, modern slugs.
Why This Still Matters
Even though this snippet dates back to the early Sitefinity 4.x days, the concept is still relevant for anyone dealing with bulk URL corrections after migrations.
If you’ve ever imported large content sets or upgraded from older CMS versions, regenerating slugs like this can save hours of manual work.