This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: 301 redirect Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
deanw
Newbie
Newbie


Joined: 03 September 2008
Online Status: Offline
Posts: 5
Posted: 16 November 2011 at 10:13am | IP Logged Quote deanw

I've successfully created a rewrite so that
http://mycorvettesite.com/detail.asp?car=1990
rewrites to
http://mycorvettesite.com/1987-corvette/1990
using the rule
RewriteRule ^/(.+)-corvette/(\d+)$ /detail.asp?Car=$2&year=$1&r=1 [I,L]

How would I setup a 301 redirect for these URLs?


Back to Top View deanw's Profile Search for other posts by deanw
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 17 November 2011 at 3:00am | IP Logged Quote Anton

It should be:

RewriteRule /detail\.asp\?Car=(\d+)&year=(.+)&r=1 /$1-corvette/$2 [I,RP]

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
deanw
Newbie
Newbie


Joined: 03 September 2008
Online Status: Offline
Posts: 5
Posted: 17 November 2011 at 11:02am | IP Logged Quote deanw

Is that the 301 redirect code? It's not working for me.
Back to Top View deanw's Profile Search for other posts by deanw
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 18 November 2011 at 4:48am | IP Logged Quote Anton

"Is that the 301 redirect code? It's not working for me."
- yes, it is. Are you using ISAPI_Rewrite 2? Or maybe it's v3?

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
deanw
Newbie
Newbie


Joined: 03 September 2008
Online Status: Offline
Posts: 5
Posted: 22 November 2011 at 1:02pm | IP Logged Quote deanw

I am using version 2 and it's still not working for me.
Should I use the rule you showed instead of the one I created?
Back to Top View deanw's Profile Search for other posts by deanw
 
deanw
Newbie
Newbie


Joined: 03 September 2008
Online Status: Offline
Posts: 5
Posted: 22 November 2011 at 4:09pm | IP Logged Quote deanw

Maybe it would help to show my .ini file
--------------------------------------------------------------
[ISAPI_Rewrite]

# 3600 = 1 hour
CacheClockRate 3600

RepeatLimit 32


# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]

# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]

#corvette by year
RewriteRule ^/corvette-year-(\d+)$ /year.asp?Year=$1&r=1 [I,L]

#corvette by location
RewriteRule ^/corvette-location-(.+) /locationdetail.asp?state=$1&r=1 [I,L]

#corvette detail page
RewriteRule ^/(.+)-corvette-for-sale-(\d+)$ /detail.asp?Car=$2&year=$1&r=1 [I,L]
----------------------------------------------------------------
I changed corvette detail page slightly from the first post
Back to Top View deanw's Profile Search for other posts by deanw
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 23 November 2011 at 2:53am | IP Logged Quote Anton

Could you please give an example of request that is supposed to match against the last rule and what the output should be.

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
deanw
Newbie
Newbie


Joined: 03 September 2008
Online Status: Offline
Posts: 5
Posted: 23 November 2011 at 11:49am | IP Logged Quote deanw

I'm trying to 301 redirect
http://www.mycorvettesite.com/detail.asp?car=1234
to
http://www.mycorvettesite.com/1973-corvette-for-sale-1234
This rule works for the rewrite but I need to 301 also:
RewriteRule ^/(.+)-corvette-for-sale-(\d+)$ /detail.asp?Car=$2&year=$1&r=1 [I,L]

Thanks for your help Anton.

Back to Top View deanw's Profile Search for other posts by deanw
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 25 November 2011 at 3:56am | IP Logged Quote Anton

Here's the solution:

RewriteRule /detail\.asp\?car=(\d+) /1973-corvette-for-sale-$1 [I,RP]

Note, that it's impossible to make this rule generic as some portions used in SEO-friendly URL are lacking in the initial request.

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 

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 cannot vote in polls in this forum