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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:49:40+00:00 2026-05-21T04:49:40+00:00

I have seen many times in htaccess these type of rules : RewriteCond %{HTTP_REFERER}

  • 0

I have seen many times in htaccess these type of rules :

RewriteCond %{HTTP_REFERER} !^http://www.domain.it$ [NC]

or

RewriteCond %{HTTP_HOST} !^www\.domain\.it$ [NC]

Why is the NC flag necessary, when checking only the domain part?

I noticed browsers always converts uppercases in domain names into lower cases, so I don’t see what the [NC] flag is usueful for in this case.

I mean if we check the remaining part of the url I understand the need for [NC] flag cause on Unix systems www.domain.com/index.html is different file than www.domain.com/INDEX.HTML but I don’t understand the need of NC flag when we check only the domain part in the RewriteRule.


Since you took the time to read the above, let me ask also one minor question not directly related to NC flag, but still related to RewriteCond

Both RewriteCond shown above work well, I thought only the one with slash before dots would work (!^www\.domain\.it$) because the dot without a slash should mean ‘any char’ in regexp whilest the \. means the dot char, but surpraisingly also the other one works well, do you know why?

  • 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-21T04:49:41+00:00Added an answer on May 21, 2026 at 4:49 am

    Having [NC] is definitely not mandatory but it is recommended to have it for matching domains. Modern browsers might be converting domain names to lowercase but what about old browsers and command line utils like wget, curl etc, so you should not always rely on clients sending you lowercase domain name and keep [NC].

    About your 2nd question . matches any character therefore it is able to match www.domain.com but it will also match www-domain-com text which you don’t want to match. So it is better to have www\.domain\.com

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

Sidebar

Related Questions

How many times have we seen this type of selector: List Box Selector http://geekswithblogs.net/images/geekswithblogs_net/dotNETvinz/MoveItemsListBox.jpg
I just need little help, that is: many times i have seen http://www.xyz.com/index.jsp?etetet%rr^_frfwrw.... .
I have seen in many times in JavaScript code people add a return true
Greetings everybody. I have seen examples of such operations for so many times that
How many times have you seen someone trying to Log the command I run
I have searched through many times but have not seen this before. Probably really
I have seen many answers for this type of question but its not related
I have seen many times things like this: function customArrayIndexOf(item, array){ for (var i
I have seen this kind of code many times before, most recently at scala-user
I have done this many times and have never seen this. I have an

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.