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 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: 301 redirect
Author
Message |
deanw
Newbie


Joined: 03 September 2008
Posts: 5
Posted: 16 November 2011 at 10:13am

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
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 17 November 2011 at 3:00am

It should be:

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

__________________
Regards,
Anton
Back to Top
 
deanw
Newbie


Joined: 03 September 2008
Posts: 5
Posted: 17 November 2011 at 11:02am

Is that the 301 redirect code? It's not working for me.
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 18 November 2011 at 4:48am

"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
 
deanw
Newbie


Joined: 03 September 2008
Posts: 5
Posted: 22 November 2011 at 1:02pm

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
 
deanw
Newbie


Joined: 03 September 2008
Posts: 5
Posted: 22 November 2011 at 4:09pm

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
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 23 November 2011 at 2:53am

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
 
deanw
Newbie


Joined: 03 September 2008
Posts: 5
Posted: 23 November 2011 at 11:49am

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
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 25 November 2011 at 3:56am

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
 

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

Printable version Printable version
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