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

  • Home
  • SEARCH
  • 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 659469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:02:52+00:00 2026-05-13T23:02:52+00:00

I am struggling with a very basic regex problem in my .htaccess file that

  • 0

I am struggling with a very basic regex problem in my .htaccess file that I hope someone may be able to shed some light on. The basic premise is that I would like to teach Apache to switch any .html extension into a .var extension. I had thought that the rule would be positively trivial:

RewriteRule ^([^.]+)\.html$ $1.var

But the [^.] part simply doesn’t work. Bizarrely, it works like so

RewriteRule ^([^A-Z]+)\.html$ $1.var

I do not understand why this latter rule works. Assume I am looking for a file called “index.html” then $1 should match to “index.” and the “.html” bit should actually fail to match.

To widen the scope of the question slightly, I am actually racking my brain on how to implement a multi-lingual site. I don’t like Apache’s MultiView option because it forces upon me a flat directory structure with file extensions that aren’t recognizable to many development tools. I could go the .var type-map route but am finding that the default config for Apache doesn’t support this all that well either (hence my excursions into regex land). So while I am using mod_rewrite, I am thinking that I might go the whole hog: whenever a request for a name.html file is received and this file does not exist, check whether there exists a XX/name.html file instead, where “XX” is the language code according to the user’s preferences.

This would give me a neater directory structure, though it does perhaps not perform as well as the .var approach in a situation where the language preference of the user’s browser is not supported in by my site (in which situation .var would substitute EN or similar).

Any thoughts? Thanks.

  • 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-13T23:02:53+00:00Added an answer on May 13, 2026 at 11:02 pm

    Why don’t you just use ^(.*)\.html$? This will match any string that ends in .html. After all, filenames can contain more than one dot.

    [^A-Z]+ matches index if the regex is applied case-sensitively. Perhaps that’s the reason? Why [^.]+ should fail is beyond me, though.

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

Sidebar

Related Questions

I'm struggling with some very basic/conceptual problem with Moq and StructureMap. Given the following
I'm struggling with what is probably a very simple regex problem. I'm working on
This might be very basic question to some but I am struggling for quite
I am struggling with a very basic issue in hadoop streaming in the -file
I'm very new to Android development and am still struggling with some really basic
I'm struggling with the problem to cut the very first sentence from the string.
I've been struggling with a very strange problem. In my iPad storyboard I drag
I'm struggling with something that I am sure has a very simple method, but
I'm very new to Composite WPF and I'm struggling with the basic architecture of
I think this is almost certainly a very basic question but I'm struggling with

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.