Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6947825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:44:35+00:00 2026-05-27T13:44:35+00:00

My root dir contains some .html files. I want to remove an extension of

  • 0

My root dir contains some .html files.
I want to remove an extension of .html in address bar and add a slash in the end like this: http://domain.com/page/
I’ve tried lots of solutions, one of them:

RewriteEngine on
RewriteBase /

# redirect from ww to non-www
RewriteCond %{HTTP_HOST} ^www.nightmaar.com$ [NC] 
RewriteRule ^(.*)$ http://nightmaar.com/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.html
RewriteRule (.*)\.html$ /$1/ [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/$ $1.html [L]

RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule .*[^/]$ $0/ [L,R=301]

But the browser gives an error (too many redirects). When i’m trying to access my static html pages, there no redirects from page.html to /page/ at all.

Help me please to solve this problem :S

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:44:35+00:00Added an answer on May 27, 2026 at 1:44 pm

    You almost did it!

    Here’s what should work:

    RewriteEngine On
    RewriteBase /
    
    # redirect from www to non-www
    RewriteCond %{HTTP_HOST} ^www.nightmaar.com$ [NC] 
    RewriteRule ^(.*)$ http://nightmaar.com/$1 [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.html
    RewriteRule (.*)\.html$ /$1/ [L,R=301]
    
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule (.*)/$ $1.html [L]
    
    # Remove trailing slash:
    RewriteRule (.*)/$ $1 [L]
    
    # Now test without the trailing slash:
    RewriteCond %{REQUEST_FILENAME}.html -f
    RewriteRule . %{REQUEST_FILENAME}.html [QSA,L]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added options in application.rb: config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += Dir[#{config.root}/lib/**/] and lib\functions.rb:
In a folder I have random module files. eg. user.rb that contains module User,
I have an executable on my disk-on-key in dir\program\prog.exe I'd like to have a
I have a config file at the root directory of my project which contains
This is in the body of my index.php in root dir of site and
I have this setting. root dir| index.php config.php file.php | | |scripts|a.js | |account
I'm using gitscc with Visual Studio 2010, and would like to run some hooks.
i want to write 2 batch files. 1st: move all files in subdirs to
I am developing a web application. contents are: root dir (/var/www/) config.php index.php details.php
I have several CSS files listed in my base.html, and while one of them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.