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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:04:43+00:00 2026-05-28T06:04:43+00:00

I have split some pages in between subdomains and want to do a URL

  • 0

I have split some pages in between subdomains and want to do a URL rewrite to different pages on different subdomains in certain cases. Everything is a rewrite rule except for the final two rules in the file. Those last two rules determine which subdomain to route the path I fixed to.

The way I am doing it is if I prepend the path with an underscore (_) then it stays on subdomain A. If I prepend the path with a tilde (~) then it is redirected to subdomain B.

So I have this rule:

<rule name="Login rule" stopProcessing="false">
        <match url="(.*?)/?old-path/Login\.aspx$" />
        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{HTTP_METHOD}" pattern="GET" />
        </conditions>
        <action type="Rewrite" url="~new-path/login.aspx" />
    </rule>

Please notice there is an aspx on the end of the URL. It continues processing, but I have a generic rewrite rule at the end of the list right before the redirect ones. This is to remove all ASPX extensions on subdomain A (www), but I want to leave the ASPX extension for subdomain B (Please don’t suggest removing the suggested on the 2nd subdomain. Thanks 🙂

<rule name="Remove ASPX" stopProcessing="false">
        <match url="^([^www\.]+)\.aspx$" />
        <conditions>
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
        <action type="Rewrite" url="_{R:1}" />
    </rule>

The problem is, is this won’t work because all the URLs have www in the beginning. I am not that good with regex, but I am guessing I need to just apply this rule to all URL that has a tilde in it. I tried this, but it’s not really working either:

<match url="^_+\.aspx$" />

Basically I want this rule to ignore URLs that I have rewritten to have a ~ in them, but remove the ASPX if I placed the _ at the start of the path.

Any suggestions?

  • 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-28T06:04:44+00:00Added an answer on May 28, 2026 at 6:04 am

    If I’m understood your problem then you have URL: “~new-path/login.aspx” and you want do redirect to “~new-path/login”, right?
    Then your regex should be like this:

    ^(.*~.*)\.aspx$
    

    Note: “www” is a part of domain name and not included into matching.
    So if your full URL is “http://www.mysite.com/~new-path/login.aspx” then only “~new-path/login.aspx” piece will take part in regex matching.

    And template {R:1} will contain value in first group (braces): “~new-path/login”

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

Sidebar

Related Questions

I have some photos that are split on successive pages through will_paginate plugin. When
I have some the page elements split into separate visual blocks. I am currently
I have a string: [\n['-','some text what\rcontains\nnewlines'],\n\n trying to parse: Regex.Split(@[\n['-','some text what contains
I have text file with some text information and i need to split this
I have a windows forms app where I have split different functionality into several
Let's say I have a split view, and I want to fill half of
I need to display some data on a browser but I want to split
I have a long NSString I want to display over a couple of pages.
I need some help. I have a 2 pages in my app. Page #1
I project I have been working on has now been split between me and

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.