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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:07:41+00:00 2026-06-15T13:07:41+00:00

I am trying to use IIS URL rewrite to take a user to a

  • 0

I am trying to use IIS URL rewrite to take a user to a WWW domain instead of a non-WWW. I came across an article which uses the following regex to match domain names:

^[^\.]+\.[^\.]+$

I can’t figure out what sort of domain is being matched with this regex. Here is the complete piece of code:

<rule name="www redirect" enabled="true" stopProcessing="true">
  <match url="." />
  <conditions>
    <add input="{HTTP_HOST}" **pattern="^[^\.]+\.[^\.]+$"** />
    <add input="{HTTPS}" pattern="off" />
  </conditions>
  <action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}" />
</rule>
<rule name="www redirect https" enabled="true" stopProcessing="true">
  <match url="." />
  <conditions>
    <add input="{HTTP_HOST}" **pattern="^[^\.]+\.[^\.]+$"** />
     <add input="{HTTPS}" pattern="on" />
    </conditions>
   <action type="Redirect" url="https://www.{HTTP_HOST}/{R:0}" />
</rule>
  • 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-15T13:07:43+00:00Added an answer on June 15, 2026 at 1:07 pm
    ^     # anchor the pattern to the beginning of the string
    [^\.] # negated character class: matches any character except periods
    +     # one or more of those characters
    \.    # matches a literal period
    [^\.] # negated character class: matches any character except periods
    +     # one or more of those characters
    $     # anchor the pattern to the end of the string
    

    The anchors are important to make sure that there is nothing around the domain that is not allowed.

    As Tim Pietzker mentioned, the periods do not need to be escaped inside the character class.

    To answer your question, the most basic way: what does this match? Any string that contains exactly one ., which is neither the first nor the last character.

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

Sidebar

Related Questions

I'm trying to use the IIS 7 URL Rewrite feature for the first time,
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I'm trying to use IIS Isapi Rewrite to do the following... I need seo-friendly
I'm trying to debug an ASP.NET webapp that's configured to Use Local IIS Web
I'm trying to use Mechanize to capture a POST request which is not possible
I am trying to use IIS to host an event-driven web-application. Lets say I
I am trying to use IIS Express 8 for a MVC site in VS2012.
I am trying to use NginX as a reverse proxy for a few IIS
I am trying to use powershell to set windowsauth on a site in IIS,
This is in VS 2005. And IIS is 6.0. I am trying to use

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.