4 Replies Latest reply on Jul 15, 2013 3:59 PM by orotas

    Remove .html




      Is there any simple way to remove .html of only one content page? Thanks,

        • 1. Re: Remove .html
          orotas Level 4

          The only simple way would be to use a Vanity URL, however that wouldn't prevent authors from creating a link that includes the .html. You can probably also acheive the same effect with /etc/map.


          The best way to do this is to make user of Apache mod_rewrite for a couple of reasons:

          • URLs without and extension can't be cached by dispatcher. So if you use a vanity URL and the page is highly trafficed it could impact yor site's performance. With Apache mod_rewrite you can have a regular experssion add the .html back before dispatcher so that the page caches correct. The end user won't see it because its a redirect.
          • You can configure mod_rewrite to do a 301 redirect of the page from the .html to the no extension version to prevent end users from seeing the version with the extension. You have to make sure you get the order of the redirect and the rewrite that adds the extension in to make sure you don't create an infinite loop but if you add the final modifier to the rewrite rule this should work.

          So this approach requires you to configure apache, but it will catch all your edge cases.

          • 2. Re: Remove .html
            Jörg Hoh Adobe Employee

            But basically there's the recommendation: Don't do it.


            (It's rarely worth the effort. Although the SEO experts might differ here.)



            • 3. Re: Remove .html
              Jörg Hoh Adobe Employee



              your approach has a important drawback: vanity urls won't work anymore, when you append on every extension-less URI a ".html" extension.



              • 4. Re: Remove .html
                orotas Level 4

                My recommendation was in the context of a single URL - I was suggesting to create a rewrite rule and redirect the single URL that he he wants to strip .html from, not for the whole site. I agree with you in general trying to strip out the HTML extension is more trouble than it is typically worth - you fighting against the instints of the system and you constantly find yourself having to create on off exceptions and path holes in you logic where you forget something.