How to Add .html Extension to WordPress Permalinks

By default, WordPress permalinks are generated without file extensions like html. For most websites, this structure works well and does not require changes for SEO purposes.

There are cases where using .html may still make sense. For example, if you need to migrate your store from Magento or another platform to WooCommerce, preserving the old URL format can prevent broken backlinks and 404 errors.

Add html to permalinks

While WordPress allows .html to be added through permalink settings, this feature is limited to standard posts and pages. It does not cover custom post types or taxonomies without using code snippet or an custom permalink plugin.

If you need more granular control, such as applying the .html extension only to selected content types or keep it only for old URLs, using Permalink Manager is the most convenient solution.

Adding .html to Post Types & Taxonomies in WordPress

Compared to the standard WordPress permalink settings, Permalink Manager offer more flexibility. It allows you to add the .html extension not only to posts and pages but also to any custom post type or taxonomy.

Each custom post type and taxonomy has its own permalink format settings. The plugin also handles canonical redirects, which helps avoid broken URLs and 404 errors that can be harmful for user experience.

Step 1: Add .html Using the Permastructures Editor

To start, open the admin dashboard and navigate to "Tools -> Permalink Manager -> Permastructures".

Although the instructions below use .html as an example, you can apply the same approach to other formats like .htm or .aspx.

"Permastructures" section

Scroll down to the content type you want to update, then append .html at the end of the permastructure field and save the changes.

WooCommerce permalinks, like Magento's, may contain a.html extension.

Step 2: Bulk Updating Existing URLs

After you save the new settings, the plugin will automatically add the .html extension to permalinks for any new items you publish in WordPress. If you want to keep your existing URLs unchanged, no extra action is required.

You can still apply the new permalink format to existing URLs. To update old URLs and add the new extension to them, use the "Regenerate/reset" tool.

The plugin works this way by design. It does not overwrite existing permalinks automatically, which helps prevent unexpected URL changes, broken links, and 404 errors.

During a migration from Magento or other CMS platforms to WooCommerce, product URLs that previously ended with .html may stop working. This happens because WordPress applies a different permalink structure, which can lead to broken links.

To prevent this, you can apply the following code snippet and adjust it as needed. The snippet below keeps the original .html extension for all products' URLs published before the specific cutoff date.

/**
* Append .html extension to legacy products only.
* Targets products published before January 10, 2026.
*/
function pm_keep_old_post_uris_format( $permastructure, $post ) {
	// Only apply logic to the product post type
	if ( $post->post_type != 'product' ) {
		return $permastructure;
	}
	$timestamp = strtotime( $post->post_date );
	$cutoff_date = strtotime( '2026-01-10' );
	// Apply .html extension to products published before Jan 10, 2026
	if ( $timestamp < $cutoff_date ) {
		$permastructure = "product/%postname%.html";
	}
	// Use standard structure for newer products
	else {
		$permastructure = "product/%postname%";
	}
	return $permastructure;
}
add_filter( 'permalink_manager_filter_permastructure', 'pm_keep_old_post_uris_format', 10, 2 );

FAQ

Can I Add a .html Extension to a Single WordPress Post or Page?

In a standard WordPress setup, changing a slug such as changing "hello-world" to "welcome" is straightforward. However, WordPress itself does not allow to add a .html extension to just one specific post or page without affecting the rest of URLs.

Permalink Manager removes this limitation. It allow you to edit each URL individually directly from the post or page editor screen.

URI Editor

Can I Add Extensions Without a Plugin?

Yes, you can add .html directly through the WordPress permalink settings without installing extra plugins:

  1. Navigate to Settings > Permalinks using the sidebar menu.
  2. Select the "Custom Structure" option.
  3. Add .html suffix to the end of input field

Adding .html to WordPress URL via Settings

However, you should consider a few limitations before making this change.

  • First, this setting only applies to standard posts. It will not work for custom post types, such as WooCommerce products.
  • It is also a global change, meaning you cannot apply it to some posts while leaving others as they are.
  • After changing permalink settings, previous post URLs may return 404 errors, so you need to manually set up redirects to prevent broken links.

Do I Need to Keep Extensions in My URLs?

If your current pages use the .html extension and already rank well in search results, removing those extensions during a migration, for example from Magento to WooCommerce, can cause broken links. This often leads to a sudden drop in organic traffic.

Any change to the permalink structure affects how search engines crawl and index your site, so plan these updates with care.

For those starting a brand new website, the situation is clearer and this topic was covered by Google Search Central. In the video, John Mueller explains that Google has no preference and does not require URLs to end with any file extension.

Last updated by Maciej Bis on: February 17, 2026.


Maciej BisFounder of Permalink Manager & WordPress Developer

The developer behind Permalink Manager, a plugin for managing permalinks, has been working with WordPress, creating custom plugins and themes, for more than a decade.

Go up