1

I need to add '.htm' to all my urls on a new site - client requires that, as I am converting a old static site into WP.

(I use Remove Taxonomy Base Slug to hide the slug of my custom taxonomy "topic" url.)

Now, I have a '.htm' extension on all pages, post etc. Now, I only need to add this '.htm' extension to my custom taxonomy archives. Does anyone have an idea of how this can be done?

I tried this:

/* Add Tax extension .htm */

add_action('init', 'add_html_ext_to_custom_post_type_taxonomies');
function add_html_ext_to_custom_post_type_taxonomies() {
    add_rewrite_rule('^topic/([^/]+)\.htm', 'index.php?topic=$matches[1]', 'top');
} 

which I found here Add .html extension to custom post type taxonomies

That gave me no change at all, and I did remember to flush permalinks.

Thanks :)

  • You have asked the same question here – Pieter Goosen Apr 10 '14 at 10:01
  • Sorry, you are right - though it was no the exact same question. I meant to delete that post, as It was badly written, and not actual any more. I think this post makes much more sense, and maybe can be useful to others, instead of the other post. Sorry about that. – Athen Apr 10 '14 at 10:07
  • Not a problem, just delete your original question. You can just simply edit your question, no need to start a new question. Enjoy – Pieter Goosen Apr 10 '14 at 10:09
  • By "no change" what exactly do you mean? Note that snippet you tried seems like it would make .htm links work, but won't do anything else like changing how those links are generated by WP functions. – Rarst Apr 10 '14 at 19:09
  • Hi Rarst, by no change I mean that all the links in the custom taxonomy are not responding when I type in the extension on my urls in my browser. The site should answrer athenasdanmark.staging.wpengine.com/emn_afghanistan.htm and show the page. It does not respond, with anything else than a 404 :( – Athen Apr 14 '14 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.