redirect not working

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 32
Joined: 14 Apr 2012, 07:28

Re: redirect not working

02 May 2012, 16:27

no idea?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: redirect not working

03 May 2012, 05:29

There's smth wrong here - escaping /royal-canin/${mapani:}/1
Please, provide the rule as it is in your file.

Regards
Andrew

User avatar
Posts: 32
Joined: 14 Apr 2012, 07:28

Re: redirect not working

06 May 2012, 13:56

here it is:

Code: Select all
RewriteMap mapani txt:mapfileanide.txt
RewriteCond %{HTTP:Host} ^www\.pet-needs\.de$ [NC]
RewriteCond %{REQUEST_URI} ^/index\.asp$ [NC]
RewriteCond %{QUERY_STRING} ^m__id=2&ani=([^&]*)&pag=1 [NC]
RewriteRule ^index\.asp$ /royal-canin/${mapani:$1}/1? [NC,R=301,L]



User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: redirect not working

07 May 2012, 06:41

Solved!

there's no $1 variable. Change $1 to %1.

User avatar
Posts: 32
Joined: 14 Apr 2012, 07:28

Re: redirect not working

07 May 2012, 07:45

Then I get this:

http://www.pet-needs.de/royal-canin//1

Code: Select all
(2) init rewrite engine with requested uri /index.asp?m__id=2&ani=1&pag=1
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(3) applying pattern '^index\.asp$' to uri 'index.asp'
(4) RewriteCond: input='www.pet-needs.de' pattern='^www\.pet-needs\.de$' => matched
(4) RewriteCond: input='/index.asp' pattern='^/index\.asp$' => matched
178.112.243.22 178.112.243.22  Mon, 07-May-2012  12:42:42 GMT [www.pet-needs.de/sid#13][rid#28367848/initial] (4) RewriteCond: input='m__id=2&ani=1&pag=1' pattern='^m__id=2&ani=([^&]*)&pag=1' => matched
(5) map lookup FAILED: map=mapani[txt] key=1
(1) escaping /royal-canin//1
(2) explicitly forcing redirect with http://www.pet-needs.de/royal-canin//1
(2) internal redirect with /index.asp?m__id=2&ani=1&pag=1 [INTERNAL REDIRECT]

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: redirect not working

07 May 2012, 09:11

Here's a problem:

(5) map lookup FAILED: map=mapani[txt] key=1

There's no such entry. Or mapfile wasn't re-read. There's a nice example of a condition for non-existing in FAQ

Regards
Andrew

User avatar
Posts: 32
Joined: 14 Apr 2012, 07:28

Re: redirect not working

07 May 2012, 09:29

This is the mapani file content, the key definitely exists:

Code: Select all
katzen       1
hunde        2
frettchen    3
nager        4
voegel       5
aquaristik   6
terraristik  7
pferde       8

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: redirect not working

07 May 2012, 09:36

Try to change places of the entries vice versa. It'll work this way.

Regards
Andrew

User avatar
Posts: 32
Joined: 14 Apr 2012, 07:28

Re: redirect not working

07 May 2012, 10:32

thx, that helped.

now one more question:

is the mapping function also possible for the back writing?

RewriteRule ^royal-canin/katzen/(.*)$ index.asp?m__id=2&ani=1&pag=$1 [L]

User avatar
Posts: 32
Joined: 14 Apr 2012, 07:28

Re: redirect not working

08 May 2012, 09:27

Ok, seems I also solved that last question. I only had some errors to be fixed. ( $1 vs %1)

Previous

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 3 guests