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: two redirects together stop working
Author
Message |
richr45
Groupie


Joined: 29 July 2009
Location: United Kingdom
Posts: 48
Posted: 31 January 2012 at 9:05am

Hi, i wonder if someone could help me resolve this conflict.

Each redirect works fine on their own but if i include the two they both stop working.

 

#301 redirect to a new-URL
RewriteCond %{QUERY_STRING} ^profileid=([^&]+)&gallery=([^&]+)$
RewriteRule ^folder/info\.asp$ %1_%2? [NC,R=301,L]

#rewrite back to old-URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^_]+)_([^_]+)$ folder/info.asp?profileid=$1&gallery=$2 [NC,L]

 

 

 

#301 redirect to a new-URL

RewriteCond %{QUERY_STRING} ^city=([^&]+)&country=([^&]+)$

RewriteRule ^folder/groups\.asp$ %1_%2? [NC,R=301,L]

#rewrite back to old-URL

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([^_]+)_([^_]+)$ folder/groups.asp?city=$1&country=$2 [NC,L]

 

 

Thanks for any advice.

richard

 

 



Edited by richr45 - 31 January 2012 at 9:06am
Back to Top Visit richr45's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 01 February 2012 at 6:34am

Hello Richard,

As you can see the following two rules, that deliver content, have exctly the same patterns, so ISAPI_Rewrite doesn't know what to rewrite:

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^_]+)_([^_]+)$ folder/info.asp?profileid=$1&gallery=$2 [NC,L]

and
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^_]+)_([^_]+)$ folder/groups.asp?city=$1&country=$2 [NC,L]


I'd suggest modifying the set as in following :

Code:
#301 redirect to a new-URL
RewriteCond %{QUERY_STRING} ^profileid=([^&]+)&gallery=([^&]+)$
RewriteRule ^folder/info\.asp$ prof/%1_%2? [NC,R=301,L]

#rewrite back to old-URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^prof/([^_]+)_([^_]+)$ folder/info.asp?profileid=$1&gallery=$2 [NC,L]

#301 redirect to a new-URL
RewriteCond %{QUERY_STRING} ^city=([^&]+)&country=([^&]+)$
RewriteRule ^folder/groups\.asp$ locat/%1_%2? [NC,R=301,L]

#rewrite back to old-URL
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^locat/([^_]+)_([^_]+)$ folder/groups.asp?city=$1&country=$2 [NC,L]


Words prof and locat are taken as an example.

Regards
Andrew
Back to Top
 
richr45
Groupie


Joined: 29 July 2009
Location: United Kingdom
Posts: 48
Posted: 01 February 2012 at 3:05pm

Dear Andrew, just to say many thanks that worked a treat and really sorted out all my redirect problem. You guys do a great job.

Thanks for all your help

best wishes

Richard

Back to Top Visit richr45's Homepage
 

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

Printable version Printable version