Rewritemap from simple URL?

Topics: User Forum
Mar 8, 2011 at 8:14 PM
Edited Mar 8, 2011 at 8:16 PM

Inhouse we have several simple redirect pages based on a simple URL.

For example, http://cirs2 redirects to http://server1/Reports/Pages/Folder.aspx and

http://ipmonitor2 redirects to

I'd like to use IIRF to combine all of these into a single rule based site, but all the documentation is based on rewriting part of the URL for rewritemaps and not the entire URL.

How can I configure it for a rewritemap? I can make a basic rule for each site but it doesn't seem like best practices.

RewriteCond  %{HTTP_HOST}  ^cirs2$
RedirectRule ^/(.*)$       http://server1/Reports/Pages/Folder.aspx     [R=301]

RewriteCond  %{HTTP_HOST}  ^ipmonitor2$
RedirectRule ^/(.*)$    [R=301]



Mar 9, 2011 at 3:11 AM

I suggest something like this:


# define the map
RewriteMap   redirects       txt:c:\maps\url_redirects.txt

# redirect requests for any hosts that are found in the map
RewriteCond  ${redirects:%{HTTP_HOST}|NotFound}  !NotFound
RedirectRule ^/(.*)$        ${redirects:%{HTTP_HOST}}  [R=301]


cirs2         http://server1/Reports/Pages/Folder.aspx


Mar 11, 2011 at 2:50 PM

Thanks! It appears to be working in our testing.