Trouble Redirecting complex link

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 6
Joined: 20 Apr 2012, 11:52

Trouble Redirecting complex link

20 Apr 2012, 12:01

Hello,

My problem is that i want to redirect a complex link like:

www.homepage.com/(X(1)S(22h1mk55gqhrfq55rjtzanq0))/SpecialOffers.aspx

Now i tried some rules and all of them didn't work:

#RewriteRule ^\(X\(1\)S\(22h1mk55gqhrfq55rjtzanq0\)\)/SpecialOffers.aspx$ redirect_url [L,R=301,NC]

#RewriteRule ^.*S\(22h1mk55gqhrfq55rjtzanq0\)\)/SpecialOffers.aspx$ redirect_url [L,R=301,NC]

#RewriteRule ^.*22h1mk55gqhrfq55rjtzanq0.*/SpecialOffers.aspx$ redirect_url [L,R=301,NC]

I can redirect only if i for example change the link in the browser.. instead of ((X(1)S(... i write ((x(1)S(... or ((X(1)s(... i don't know why it behaves this way.. i even tried somethig like this:

RewriteRule ^.*\)\)/SpecialOffers

and again if i write in the browser: www.homepage.com/(X(1)S(22h1mk55gqhrfq55rjtzanq0))/SpecialOffers.aspx it won't redirect but if i write www.homepage.com/(x(1)S(22h1mk55gqhrfq55rjtzanq0))/SpecialOffers.aspx or www.homepage.com/(X(1)s(22h1mk55gqhrfq55rjtzanq0))/SpecialOffers.aspx it WORKS!! (also it works for all the above redirect rules that i tried..) i don't understand why if i write in the browser X instead of x it doesn't work.. the rule isn't case sensitive.. and also why if i modify the rule in something like this:

RewriteRule ^.*\)\)/SpecialOffers.aspx it doesn't redirect if i write (X(1)S(... instead of (x(1)S(...

Any ideas??

Regards,
Andrei Iacob

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

Re: Trouble Redirecting complex link

20 Apr 2012, 12:40

Hello,

There's no need to escape '(' or ')'. Try to delete the backslashes from your pattern and try again.

Regards
Andrew

User avatar
Posts: 6
Joined: 20 Apr 2012, 11:52

Re: Trouble Redirecting complex link

23 Apr 2012, 04:33

Hello,

I tried that and it isn't working. As far as i know the "()" brackets are used to identify a group.. e.g: ^somepage/test=([\w,-]*)$ redirect_page/$1 [I,L,NC] where $1 is the group identified by the ([\w,-]*) expression. Now.. the problem is that even if i try to match only a piece of the link.. e.g.: "RewriteRule ^.*22h1mk.*$ redirect_page" the same resource not found problem appears.. and if i change the link.. instead of X(1) i write x(1) the REDIRECT WORKS!!!

Example:

RewriteRule ^(X(1)S(22h1mk55gqhrfq55rjtzanq0))/SpecialOffers.aspx$ redirect_url [L,R=301,NC] NOT WORKING

RewriteRule ^(x(1)S(22h1mk55gqhrfq55rjtzanq0))/SpecialOffers.aspx$ redirect_url [L,R=301,NC] WORKING!!! (the difference is only the x letter)

As you can see i decorated the rule with the NC attribute.. so it isn't a case sensitive problem. I think that the problem comes from how isapi reads the link.. because the "capital letter" problem appears for each letter i choose instead of X.. e.g.: if i choose A or B or C or.. the problem persists.. but if i choose a or b or c the link redirects.. also.. if i write X and modify the next S into s the link REDIRECTS!!

Example:

RewriteRule ^(X(1)S(22h1mk55gqhrfq55rjtzanq0))/SpecialOffers.aspx$ redirect_url [L,R=301,NC] NOT WORKING

RewriteRule ^(x(1)s(22h1mk55gqhrfq55rjtzanq0))/SpecialOffers.aspx$ redirect_url [L,R=301,NC] WORKING!!! (the difference is only the s letter)

Why it behaves this way??.. seems like it tries to identify a function or something.. i don't know.. because if i write "xX" instead of "X" it WORKS!!..

Regards,
Andrei Iacob

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

Re: Trouble Redirecting complex link

23 Apr 2012, 05:55

I thought the same about reading a function when I saw "x\", so I suggested avoiding '\' in those places where it's unnecessary. I'll try to test

User avatar
Posts: 6
Joined: 20 Apr 2012, 11:52

Re: Trouble Redirecting complex link

25 Apr 2012, 04:31

Hello,

I tried that but it still doesn't work.. i don't know why isapi behaves this way..

Let me give you another clue.. e.g: ((X(1)S(22h1mk55gqhrfq55rjtzanq0)) this is the problematic string.. so.. if i remove the last bracket => ((X(1)S(22h1mk55gqhrfq55rjtzanq0) the link redirects correctly

The rule for this link is:

RewriteRule ^\(X\(1\)S\(22h1mk55gqhrfq55rjtzanq0\)/SpecialOffers.aspx$ special-offers/page=1? [L,R=301,NC]

But if i add the last bracket (also in the redirect rule) i have those problems.. i think the problem comes from how the isapi process the url.. because i told you that if i try a rule like this:

RewriteRule ^.*k55gqhrfq55rjtzanq0.*$ special-offers/page=1? [L,R=301,NC]

it still doesn't redirect for this link.. and the rule doesn't contain any brackets..

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

Re: Trouble Redirecting complex link

25 Apr 2012, 05:43

the real way to find out - os to provide rewrite.log for the testing request. Please, provide one with ')' and one without.
Logging issues described in FAQ

Regards
Andrew

User avatar
Posts: 6
Joined: 20 Apr 2012, 11:52

Re: Trouble Redirecting complex link

27 Apr 2012, 04:00

Hello,

I made an archive with the htaccess, error.log and rewrite.log for both success and fail examples. (i named them properly e.g : error_success.log and error_fail.log)

In the error.log i don't have any errors.. so i don't know.. i think it is an isapi bug or something.. it is possible to find a workaround for this problem?? i really need to redirect this kind of links.. and all of them are having the same problem.. with the brackets.. so.. any ideas? :(

Regards,
Andrei Iacob
Attachments
archive.rar
(2.36 KiB) Downloaded 1446 times

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

Re: Trouble Redirecting complex link

27 Apr 2012, 07:03

It's hard to say smth, tt you success log I see:

Code: Select all
(2) init rewrite engine with requested uri /ib.website/(X(1)S(22h1mk55gqhrfq55rjtzanq0)/SpecialOffers.aspx
(1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
(1) Htaccess process request d:\work_andrei\telliso_ib\trunk\ib.website\.htaccess
(3) applying pattern '^\(X\(1\)S\(22h1mk55gqhrfq55rjtzanq0\)/SpecialOffers.aspx$' to uri '(X(1)S(22h1mk55gqhrfq55rjtzanq0)/SpecialOffers.aspx'
(1) escaping http://www.google.com
(2) explicitly forcing redirect with http://www.google.com
(2) internal redirect with /ib.website/(X(1)S(22h1mk55gqhrfq55rjtzanq0)/SpecialOffers.aspx [INTERNAL REDIRECT]


in fail log I do not see any relevant requests, only the following:

Code: Select all
(2) init rewrite engine with requested uri /ib.website/
(2) init rewrite engine with requested uri /ib.website/default.aspx/GetDropDownContents
(2) init rewrite engine with requested uri /ib.website/GetGenericHtmC2PId
(2) init rewrite engine with requested uri /ib.website/Resources/swf/regionmap.swf?xml_path=Resources/swf/regions.xml?cache=1335509207363
(2) init rewrite engine with requested uri /ib.website/Resources/swf/regions.xml?cache=1335509207363?randombit=0.798641042783856
(2) init rewrite engine with requested uri /ib.website/SpecialOffers.aspx


We need an example of not working request in a log, please.
We'll be happy to help and assist. But we suspect it's not ISAPI_Rewrite. It's smth new, at least, for the last 3 years.

Regards
Andrew

User avatar
Posts: 6
Joined: 20 Apr 2012, 11:52

Re: Trouble Redirecting complex link

02 May 2012, 09:51

Hello,

[5/2/2012 15:41:28] Unknown expression in the file d:\sites\ib-tellisosvn\trunk\ib.website\.htaccess, on the line #10: RewriteRule ^\(X\(1\)S(22h1mk55gqhrfq55rjtzanq0\)\)/SpecialOffers.aspx$ special-offers/page=1 [L,R=301]
[5/2/2012 15:41:28] d:\sites\ib-tellisosvn\trunk\ib.website\.htaccess - Loaded successfully

If i write an incorrect rule the error log displays indeed the error..(i have highlighted the error in the rule)

But the previous rules were all correct.. therefore there were no errors in error.log.. i don't know.. did you manage to redirect this kind of link.. also i have the same problem in redirect this links (all of them have the same pattern) :

RewriteRule ^\(S\(re1o0ebxtv42cj55cujmge45\)\)/SpecialOffers.aspx$ special-offers/page=1 [L,R=301]
RewriteRule ^\(X\(1\)S\(22h1mk55gqhrfq55rjtzanq0\)\)/SpecialOffers.aspx$ special-offers/page=1 [L,R=301]
RewriteRule ^\(X\(1\)S\(kkb4drf1azi1wrevnwjw5k45\)/SpecialOffers.aspx$ special-offers/page=1 [L,R=301]

and none of them can be redirected..

Can you try to redirect one of these links.. i tried to redirect these links also on a different machine and they gave the same result..

User avatar
Posts: 6
Joined: 20 Apr 2012, 11:52

Re: Trouble Redirecting complex link

14 May 2012, 05:50

Hello,

Do you think that there is any chance that we could find a work around or a solution for this problem? :(

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 1 guest