The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Technical SEO Issues
    4. How to remove .html ending with mos rewrtie

    How to remove .html ending with mos rewrtie

    Technical SEO Issues
    3 2 615
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • sesertin
      sesertin last edited by

      I have a page and I want to remove .html ending from urls. What should I write in the htaccess?

      1 Reply Last reply Reply Quote 0
      • First
        First last edited by

        Did you try this?

        RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.html [NC,L]

        or to add a trailing slash:

        `RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^([^/]+)/$ $1.html
        RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.html

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/)$
        RewriteRule (.*)$ /$1/ [R=301,L]`

        sesertin 1 Reply Last reply Reply Quote 0
        • sesertin
          sesertin @First last edited by

          neither works for me. my urls are still in domain.com/file.html format

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          • Add trailing slash after removing .html extention
            NeatIT
            NeatIT
            0
            6
            712

          • This question has been removed
            phil907
            phil907
            0
            5
            351

          • Removing extension
            UmarKhan
            UmarKhan
            0
            2
            223

          • Using the Google Remove URL Tool to remove https pages
            sparrowdog
            sparrowdog
            1
            3
            5.9k

          • Are permalinks ending in / different than permalinks with nothing at the end?
            Kara.Wallace
            Kara.Wallace
            0
            2
            55

          • Is it good to remove page extensions like ".php" or ".htm" in the end of URL as SEO prospects?
            BlueprintMarketing
            BlueprintMarketing
            0
            8
            12.9k

          • True HTML
            Ideas-Money-Art
            Ideas-Money-Art
            0
            3
            324

          • Urls with or without .html ending
            KeriMorgret
            KeriMorgret
            0
            6
            3.0k

          Get started with Moz Pro!

          Unlock the power of advanced SEO tools and data-driven insights.

          Start my free trial
          Products
          • Moz Pro
          • Moz Local
          • Moz API
          • Moz Data
          • STAT
          • Product Updates
          Moz Solutions
          • SMB Solutions
          • Agency Solutions
          • Enterprise Solutions
          • Digital Marketers
          Free SEO Tools
          • Domain Authority Checker
          • Link Explorer
          • Keyword Explorer
          • Competitive Research
          • Brand Authority Checker
          • Local Citation Checker
          • MozBar Extension
          • MozCast
          Resources
          • Blog
          • SEO Learning Center
          • Help Hub
          • Beginner's Guide to SEO
          • How-to Guides
          • Moz Academy
          • API Docs
          About Moz
          • About
          • Team
          • Careers
          • Contact
          Why Moz
          • Case Studies
          • Testimonials
          Get Involved
          • Become an Affiliate
          • MozCon
          • Webinars
          • Practical Marketer Series
          • MozPod
          Connect with us

          Contact the Help team

          Join our newsletter
          Moz logo
          © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
          • Accessibility
          • Terms of Use
          • Privacy