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 8427617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:49:41+00:00 2026-06-10T04:49:41+00:00

I’m having some troubles with my .htaccess file, I have code placed in which

  • 0

I’m having some troubles with my .htaccess file, I have code placed in which removes the extensions of files so it looks like this: http://www.foo.com/x and it works fine for all of my pages. However, when I use my navigation bar it doesn’t work. I’ve already changed the URLs on each page to http://www.foo.com/x, so I’m confused as to what my problem could be. Here’s the code in my .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301]

And here’s my nav-bar code:

 <ul id="menu">
            <li><a href="http://www.foo.com/" class="active">Home</a></li>
            <li><a href="http://www.foo.com/projects">Projects</a></li>
            <li><a href="http://www.foo.com/about">About</a></li>
            <li><a href="http://www.foo.com/contact">Contact</a></li>
 </ul>

I might add that http://www.foo.com/projects, etc. works fine and goes to the correct page also my .htaccess file is in the root folder if that wasn’t obvious.

  • 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-06-10T04:49:43+00:00Added an answer on June 10, 2026 at 4:49 am

    Your original rules are going to cause a loop if you try to internally rewrite them back. For example, if you start off with the URI /some/file.html

    1. Browser requests /some/file.html
    2. RewriteRule ^(.*)\.html$ /$1 [L,R=301] matches, browser is redirected to /some/file
    3. Browser requests /some/file
    4. Internal rewrite to /some/file.html
    5. Rewrite engine loops, first rule matches again, browser is redirected to /some/file
    6. repeat from #3

    So you need to match against the actual request for your first rule:

    RewriteEngine On
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.html
    RewriteRule ^ /%1 [L,R=301]
    

    This does the redirect, in case you have links that still go to the .html files, now you need to internally rewrite them back to html files:

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

    If all of your links already have the .html part removed, then you won’t need the first rule at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from

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.