This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: two redirects together stop working Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
richr45
Groupie
Groupie


Joined: 29 July 2009
Location: United Kingdom
Online Status: Offline
Posts: 48
Posted: 31 January 2012 at 9:05am | IP Logged Quote richr45

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 View richr45's Profile Search for other posts by richr45 Visit richr45's Homepage
 
Guests
Guest
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -149
Posted: 01 February 2012 at 6:34am | IP Logged Quote Guests

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 View Guests's Profile Search for other posts by Guests
 
richr45
Groupie
Groupie


Joined: 29 July 2009
Location: United Kingdom
Online Status: Offline
Posts: 48
Posted: 01 February 2012 at 3:05pm | IP Logged Quote richr45

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 View richr45's Profile Search for other posts by richr45 Visit richr45's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum