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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:40:34+00:00 2026-06-02T06:40:34+00:00

I wanna convert this apache .htaccess lines to web.cofig: RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC] RewriteRule

  • 0

I wanna convert this apache .htaccess lines to web.cofig:

RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]

RewriteRule ^(.*)$ http://%1/$1 [L,R=302]

with these codes I can redirect all request with www. even if my website has too many domains.

  • 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-02T06:40:36+00:00Added an answer on June 2, 2026 at 6:40 am

    I research and found my answer. for use variables in conditions we can use {C:1}. that 1 is for first match. and my ecxact answer for this converting is:

            <rules>
                <rule name="http Redirect" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^www\.(.*)$" />
                        <add input="{SERVER_PORT_SECURE}" pattern="^0$" />
                    </conditions>
                    <action type="Redirect" url="http://{C:1}/{R:1}" appendQueryString="true" redirectType="Permanent" />
                </rule>
                <rule name="https Redirect" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^www\.(.*)$" />
                        <add input="{SERVER_PORT_SECURE}" pattern="^0$" negate="true" />
                    </conditions>
                    <action type="Redirect" url="https://{C:1}/{R:1}" appendQueryString="true" redirectType="Permanent" />
                </rule>
            </rules>
    

    That is equal to:

    RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
    RewriteCond %{HTTPS} ^off$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [L,QSA,R=302]
    RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
    RewriteCond %{HTTPS} ^on$ [NC]
    RewriteRule ^(.*)$ https://%1/$1 [L,QSA,R=302]
    

    Good Luck

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

Sidebar

Related Questions

The customer wanna preview mpp content without open Project Professional.So I decide to convert
I wanna verify a digitally signed xml against its schema definition while this schema
I wanna implement a javascript like method in java , is this possible ?
So i wanna do something like this in php. If i have a year
By using XML API, I got date-time as 2008-02-05T12:50:00Z . Now I wanna convert
Hey, I wanna to add AOP to my web project. I download ajdt2.0.1 for
I'm a beginner for Perl and CPAN Modules I wanna convert a xml file
Well, my question is very simple, i just wanna convert the output of imagepng
Is there a equivalent on .net of the string parsing of Datejs ( http://www.datejs.com/
The following code works perfectly. My only concern is that I wanna convert below

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.