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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:11:08+00:00 2026-06-17T16:11:08+00:00

(I’ve browsed through a ton of links on stack and articles like this on

  • 0

(I’ve browsed through a ton of links on stack and articles like this on Microsoft http://forums.iis.net/t/1161629.aspx/1 Anything regarding sub-domains on stack either doesn’t have an answer or the solution simply doesn’t work. Please keep this in mind before flagging as "duplicate". I did my homework before asking)

I’m not certain whether or nto this has anything to do with MVC4 or not but here is my rule:

<rewrite>
  <rules>
    <rule name="Apply Sub-Domain as Query String Argument" stopProcessing="false">
      <match url="^(.+)$" />
      <conditions trackAllCaptures="false">
                    <add input="{HTTP_HOST}" pattern="^(^local[a-z0-9]+)\.domain\.com(.*)$" />
      </conditions>
      <action type="Rewrite" url="https://local.domain.com{C:2}?cobrand={C:1}" logRewrittenUrl="false" />
    </rule>
  </rules>
</rewrite>

I expect this for a url of https://subdomain.domain.com to send this into MVC4 as https://local.domain.com?cobrand=subdomain but it isn’t firing.

In my MVC application I have a view defined as:

<div>
    Cobrand = @HttpContext.Current.Request.QueryString["cobrand"]
</div>
<div>
    Requested URL = @HttpContext.Current.Request.Url
</div>
<div>
    Path = @HttpContext.Current.Request.Path
</div>

With the following output for this requested url https://localdemo1.domain.com :

<div>
    Cobrand = 
</div>
<div>
    Requested URL = https://localdemo1.domain.com
</div>
<div>
    Path = /
</div>

My desired output is:

<div>
    Cobrand = localdemo1
</div>
<div>
    Requested URL = https://local.domain.com?cobrand=localdemo1
</div>
<div>
    Path = /
</div>

A note about the site setup:

The IIS Site has bindings for:

HTTP::

local.domain.com

localdemo1.domain.com

localdemo2.domain.com

HTTPS::443 (No host configuration, can’t configure host on 443 but it’s configured to allow SSL)

PS: I tried this without HTTPS and it yields the same results, as not firing at all.

  • 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-17T16:11:09+00:00Added an answer on June 17, 2026 at 4:11 pm

    Here is what works for me:

    <rewrite>
      <rules>
        <rule name="Apply Sub-Domain as Query String Argument" stopProcessing="false">
          <match url="^.*$" />
          <conditions trackAllCaptures="false">
                        <add input="{HTTP_HOST}" pattern="^(^local[a-z0-9]+)\.domain\.com(.*)$" />
          </conditions>
          <action type="Redirect" url="https://local.domain.com{R:0}?cobrand={C:1}" />
        </rule>
      </rules>
    </rewrite>
    

    Note that the match url as changed (accepting empty values) and that type="Redirect" has replaced type="Rewrite".

    {C:2} doesn’t work in this case (I am not able to tell you why…) but you can use {R:0} instead.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
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
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.