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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:34:59+00:00 2026-05-13T07:34:59+00:00

I have an htaccess file which begins with the regular stuff: RewriteEngine on RewriteBase

  • 0

I have an htaccess file which begins with the regular stuff:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

then has a few rewrites eg:

RewriteRule ^protect/?$ /Legal/Your-Financial-Protection.aspx   [NC, L, R=301]

then ends with a rewritemap:

RewriteMap map txt:rewritemaps/map.txt  [NC]
RewriteRule ^(.+)$  ${map:$1}   [R=301]

The rewritemap contains all of our legacy urls – pages on our current site and short urls that will be redirected to equivalent pages on the new site (there are about 4k, so I need to use a map really):

Inspiration.aspx /Inspiration.aspx
Destinations/Africa/Countries/Gabon.aspx /Destinations/Africa/Gabon.aspx
indonesia /Destinations/Southeast-Asia/Indonesia.aspx

The problem is, with the rewritemap enabled (ie not commented out), all my urls (even those not matched) redirect to / – including stylesheets, js, images etc.

What I’m after is uris that match the pattern in the map to redirect to the replacement and everything else to pass through (ie stay the same).

I’ve tried setting a default of $1 on the map:

RewriteRule ^(.+)$  ${map:$1|$1}    [R=301]

but this just causes a redirect loop. I think I could also skip rewriting for all .css, .js, .jpg etc but would rather not have to maintain a list of used file extensions.

FYI, I’m using ISAPIRewrite from HeliconTech (as I’m on IIS 6) although it claims to handle rewritemaps as per apache and we’ve never had problems in the past.

Any help would be hugely appreciated!

Thanks, Adam

  • 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-13T07:34:59+00:00Added an answer on May 13, 2026 at 7:34 am

    Just put only the pairs in the map that actually differ. Otherwise you will redirect to the same value and get an infinite recursion.

    And to redirect only when a match is found, try this:

    RewriteCond ${map:$1} ^/.+
    RewriteRule ^(.+)$ %0 [R=301]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have such .htaccess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php
i have .htaccess file which includes below code. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond
I have a .htaccess file on a website I'm working on which rewrites urls
I have the following .htaccess file which works fine for say www.companyone.com: RewriteEngine On
I have a htaccess-file like the following: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /
In my root directory I have a htaccess file which is caching all sort
So I have the following .htaccess file contents from my other project which is
I have the following in a .htaccess file redirect 301 /page.php http://domain.com/page Which works
I have a link which looks like that: www.domain.com/file.php I want to create .htaccess
I have this little .htaccess file: RewriteEngine on RewriteRule ^(.*)$ urlroute.php?q=$1 [E=myvariable:'withthisvalue',B,QSA] To direct

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.