.html extension in WordPress

As i’ve been working through a new site build that integrates a WordPress blog I’ve hit across an interesting problem.

Although through WordPress’ permalinks settings you are fully capable of giving a post a .html extension it seems impossible to do the same with pages. This seems a little odd, I tried a couple of things, such as changing the page permalink that it allows you to do, but when you add the .html WordPress removes the dot and leaves you with pagehtml rather than page.html.

Luckily if I enter .html into a browser it will redirect, however this leaves inconsistent url’s through the site. If the system can handle .html for a post, why not a page?

Comments

  • Lasse Heindorff

    We have a similiar issue. We’re implementing WordPress on our website to handle our news section. We’re using .html extensions on all pages, which isn’t an issue as such since it’s easily changed with /%postname%.html in Permalinks. The problem is that Google likes consistency in URLs and we use .html on folders aswell.

    For instance our (excisting) news section with teasers has this URL:

    domain.com/news.html

    A news article has this URL structure:

    domain.com/news/post.html

    So basically a folder doesn’t have the folder slash, but instead an .html extension a level down, which is removed when viewing an article in that folder/section (of course). Normally in these cases people would have used this type of URL for the folder/section:

    domain.com/news

    or

    domain.com/news/ (adding another level with the slash)

    Our problem is more specifically related to categories in WP. Say a category has the name “Real Estate”. The URL then becomes:

    domain.com/category/real-estate

    Leaving us with a page without the .html extension and consistency is all of the sudden flushed down the drain.

    Any clues to a solution would be much appreciated.

    Lasse

  • fornetti

    I do not believe this

  • Digital Nomad

    There is a plugin that does this for “pages”.

  • Lasse Heindorff

    What an informative comment, Digital Nomad. Adding a link to the plugin or naming it might bring value to it, though. Just a suggestion.

  • Kean

    There does seem to be a plugin available now at http://www.introsites.co.uk/33~html-wordpress-permalink-on-pages-plugin.html

    So far I’ve tested on one site and it does appear to work, however the old url’s without .html will not redirect to the new pages with .html so creating htaccess redirects (or similar) would be needed to keep everything working smoothly

  • pallyweb

    not working with .html for this you should use static page plugin for wordpress very fast then any wp cache plugin

  • John

    This Plug-in will do the job for pages. But unable to get a solution to put a extension on category urls.
    Link to plugin home page:
    http://wordpress.grandslambert.com/plugins/custom-page-extensions.html

  • centrum handlowe

    thx for information.

    John thank you for link to great plugin.

  • Sale Generators

    how about in category ? instead of /category/ it look like this /category.html . Please help . Thanks in advance

  • Kean

    I don’t think it’s possible to do this with categories, a quick search shows no plugins that allow you to do it. I imagine it may be possible if you hacked apart the base WordPress install but I’d imagine this would be a lot of work for only small returns.

  • Sale Generators

    Thanks Kean, The only solution i have is url redirection plugin . Thanks again

Write a Comment