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

The Archive Base Latest Questions

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

I use a standard web.config file for my projects that are hosted on Windows

  • 0

I use a standard web.config file for my projects that are hosted on Windows servers. It takes care of 2 tasks.

  1. It redirects the non-www version of the site to the www version.
  2. It redirects the index file to the root.

See below:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true" />
        <rewrite>
            <rules>
                <rule name="CanonicalHostNameRule1" stopProcessing="true">
                    <match url="index\.asp(?:l)?" />
                        <conditions>
                            <add input="{HTTP_HOST}" pattern="example\.com$" />
                        </conditions>
                        <action type="Redirect" url="http://www.example.com/" />
                </rule>
                <rule name="CanonicalHostNameRule2" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^example\.com$" />
                    </conditions>
                    <action type="Redirect" url="http://www.example.com/{R:1}" />
                </rule>
            </rules>
        </rewrite>
  </system.webServer>
</configuration>

This works great, except for 1 problem. The index redirect is redirecting all sub-directories to the main, index.

For example:

http://www.example.com/index.asp is redirecting to http://www.example.com like it should.

But, http://www.example.com/about/index.asp is also redirecting to http://www.example.com. I would like it to redirect to http://www.example.com/about/

Any help would be greatly appreciated.

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

    Well, after getting no response here, I posted on various .Net forums and finally got an answer. This rule will fix it:

    <rule name="redirect index.asp" stopProcessing="true">
        <match url="^(\w*/)?index\.asp" />
           <conditions>
             <add input="{HTTP_HOST}" pattern="domain\.com$" />
           </conditions>
         <action type="Redirect" url="http://www.domain.com/{R:1}" />
    </rule>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Any section in my web.config file that I want to encrypt I run this
Recently, I discovered that the Web.Config file contains an <appSettings> section which seemed good
I use the standard web.config 'mailSettings' as the backbone for my ASP.NET emails. However,
I just noticed that you can not use standard math operators on an enum
I would like to override the use of the standard app.config by passing a
I have a solution that contains two projects. One project is an ASP.NET Web
I have a Java EE web application that does not make use of EJBs.
Just wondering if there is a standard/default overlay/marker that I can use in the
In ASP.Net I usually drive my primary navigation using a standard web.sitemap file such
We're planning to use standard ASP.NET user authentication for our application. However, by default

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.