310 (net::ERR_TOO_MANY_REDIRECTS

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 8
Joined: 20 Aug 2012, 14:46

310 (net::ERR_TOO_MANY_REDIRECTS

20 Aug 2012, 17:18

Hello,

Dynamic URL is http://website/?catid=275
Friendly URL is http://website/index/catid/275/

RewriteEngine on
RewriteRule index/(.*)/(.*)/$ /index.asp?$1=$2
RewriteCond %{QUERY_STRING} ^catid=([0-9]+)$ [NC]
RewriteRule ^/(.*)$ /index/catid/%1/? [NC,R=301,L]

Resulting to Error 310 (net::ERR_TOO_MANY_REDIRECTS)
What I'm doing wrong? I wish both URLs work..

Please advice.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

21 Aug 2012, 03:45

Please try to fix it like this:

RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^catid=(\d+)$ [NC]
RewriteRule ^/?$ /index/catid/%1/? [NC,R=301,L]

RewriteRule ^index/catid/([^/]+)/$ /\?catid=$1 [NC,L]

User avatar
Posts: 8
Joined: 20 Aug 2012, 14:46

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

21 Aug 2012, 03:58

Anton wrote:Please try to fix it like this:

RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^catid=(\d+)$ [NC]
RewriteRule ^/?$ /index/catid/%1/? [NC,R=301,L]

RewriteRule ^index/catid/([^/]+)/$ /\?catid=$1 [NC,L]


Anton, it doesnt' work.
http://website/index/catid/275/ resulted in 301 Too Many Redirects..
Any thoughts?
Thanks.

User avatar
Posts: 8
Joined: 20 Aug 2012, 14:46

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

21 Aug 2012, 12:22

Sounds like hard case?)

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

22 Aug 2012, 03:03

Hello,

Can you please make sure you don't have ISAPI_Rewrite filter registered twice: on global (server) level and for the site. If that's the case, please leave the filter on global level only.

User avatar
Posts: 8
Joined: 20 Aug 2012, 14:46

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

22 Aug 2012, 04:03

You were write. It works.
Thanks.

User avatar
Posts: 8
Joined: 20 Aug 2012, 14:46

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

22 Aug 2012, 04:54

RewriteCond %{QUERY_STRING} ^catid=(\d+)&linkid=(\d+)&title=(\.*)$ [NC]
RewriteRule ^/?$ /index/catid/%1/linkid/%2/title/%3/? [NC,R=301,L]
RewriteRule ^index/catid/([^/]+)/linkid/([^/]+)/title/(.*)/$ /\?catid=$1&linkid=$2&title=$3 [NC,L]
#
RewriteCond %{QUERY_STRING} ^catid=(\d+)&linkid=(\d+)$ [NC]
RewriteRule ^/?$ /index/catid/%1/linkid/%2/? [NC,R=301,L]
RewriteRule ^index/catid/([^/]+)/linkid/([^/]+)/$ /\?catid=$1&linkid=$2 [NC,L]

Please advice: first block of rules doesn't work (with title=any-alpha-numeric)
Second block works fine. What's wrong?

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

22 Aug 2012, 05:04

If you want the 'title' in the first block to catch any alphanumeric, it should look like this:

RewriteCond %{QUERY_STRING} ^catid=(\d+)&linkid=(\d+)&title=(\w+)$ [NC]
RewriteRule ^/?$ /index/catid/%1/linkid/%2/title/%3/? [NC,R=301,L]
RewriteRule ^index/catid/([^/]+)/linkid/([^/]+)/title/(.*)/$ /\?catid=$1&linkid=$2&title=$3 [NC,L]

Please try.

User avatar
Posts: 8
Joined: 20 Aug 2012, 14:46

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

22 Aug 2012, 18:25

Thank you very much.
Probably simple question for you- how to rewrite ?lang=rus& to /lang/rus/ and vice versa?
URL exact: ?lang=rus&
Please advice.

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

23 Aug 2012, 03:39

Please try the following:

RewriteCond %{QUERY_STRING} ^lang=(\w+)&$ [NC]
RewriteRule ^/?$ /lang/%1/? [NC,R=301,L]
RewriteRule ^lang/(\w+)/$ /\?lang=$1& [NC,L]

User avatar
Posts: 8
Joined: 20 Aug 2012, 14:46

Re: 310 (net::ERR_TOO_MANY_REDIRECTS

23 Aug 2012, 04:23

Super. Thanks!

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 25 guests