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: rewritecond with rewritemap
Author
Message |
diuzza85
Newbie


Joined: 24 October 2011
Posts: 5
Posted: 24 October 2011 at 4:58am

Hi,
I have a question.
I have these links
index.asp?var1=aaaa&var2=bbbb
i have to do a redirect 301 in this form
test.html

this is my code
Code:
RewriteCond %{QUERY_STRING} var1=aaaa&var2=bbbb
RewriteRule ^index.asp$ test.html? [NC,R=301,L]


But list link is very long
is there the possible of using "rewritemap" for this?


Edited by diuzza85 - 24 October 2011 at 4:59am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 24 October 2011 at 5:38am

Hello,

Sure, here's the code from our examples section:

Code:
RewriteMap mymap txt:map.txt
RewriteCond %{REQUEST_URI} ^/([^/]+)/?$
RewriteRule ^index\.asp$ ${mymap:%1}? [NC,L]


Regards
Andrew
Back to Top
 
diuzza85
Newbie


Joined: 24 October 2011
Posts: 5
Posted: 24 October 2011 at 5:40am

Thank you!
And map.txt contains

var1=aaaa&var2=bbbb test.html

correct?

don't work
send me at the index.asp without var1=aaaa&var2=bbbb

Edited by diuzza85 - 24 October 2011 at 5:55am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 24 October 2011 at 7:52am

Yes, correct.

Try using:
RewriteCond %{QUERY_STRING} ^([^/]+)$
instead of
RewriteCond %{REQUEST_URI} ^/([^/]+)/?$
Back to Top
 
diuzza85
Newbie


Joined: 24 October 2011
Posts: 5
Posted: 24 October 2011 at 8:03am

this is my code
Code:

RewriteMap mapfile3 txt:mapfile3.txt
RewriteCond %{QUERY_STRING} ^([^/]+)$
RewriteRule ^index\.asp$ ${mapfile3:%1}? [NC,R=301,L]


but all links are redirected at index.asp
Back to Top
 
diuzza85
Newbie


Joined: 24 October 2011
Posts: 5
Posted: 25 October 2011 at 2:25am

there isn't solution?
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 25 October 2011 at 5:28am

I'm sure there's. We just need to know where the rule breaks.

Please, provide the rewrite.log for the testing request. Logging issues described in FAQ

Regards
Andrew
Back to Top
 
diuzza85
Newbie


Joined: 24 October 2011
Posts: 5
Posted: 26 October 2011 at 5:00am

sorry my mistake!
now works
thank you

but now i've another problem...
all the links conteined in mapfile3.txt are redirected correctly at test.html...
but all links starting with index.asp?... are redirected at index.asp, also if there aren't in mapfile3.txt

why?
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 26 October 2011 at 5:47am

Try using the following condition with your rule:

RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND

Regards
Andrew
Back to Top
 

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

Printable version Printable version