This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: Redirect from .htm to query string value
Author
Message |
vallas
Newbie


Joined: 22 February 2012
Posts: 9
Posted: 27 February 2012 at 6:10pm

OK, still new at this but understanding a little more
each day.

I have a redirect like this that works fine:

RewriteRule ^site1/products/prod1.htm
/site2/pages/family.aspx?id=999

It sends this
www.mysite.com/site1/products/prod1.htm
to here
www.mysite.com/site2/pages/family.aspx?id=999

How can I use a map file with values like the following
to obtain the same result?:

prod1.htm id=999

Thank you.
Back to Top
 
vallas
Newbie


Joined: 22 February 2012
Posts: 9
Posted: 28 February 2012 at 12:39pm

I want to use a mapfile because I found out that there are
many cases like this that follow a pattern and I don't want
to put all the rules in the .htaccess file.

Thanks.
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 29 February 2012 at 4:36am

Hello,

Please, try using the following:

Code:
RewriteEngine on
RewriteBase /
RewriteMap mapfile txt:mapfile.txt
RewriteRule ^site1/products/([^/]+\.htm)$ /site2/pages/family.aspx?${mapfile:$1} [NC,L]


Regards
Andrew
Back to Top
 
vallas
Newbie


Joined: 22 February 2012
Posts: 9
Posted: 01 March 2012 at 10:30am

Thank you very much Andrew.

I added R=301 and worked like a charm.

Regards.
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version