| Author |
|
deanw Newbie

Joined: 03 September 2008
Online Status: Offline Posts: 5
|
| Posted: 16 November 2011 at 10:13am | IP Logged
|
|
|
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
Online Status: Offline Posts: 10520
|
| Posted: 17 November 2011 at 3:00am | IP Logged
|
|
|
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
Online Status: Offline Posts: 5
|
| Posted: 17 November 2011 at 11:02am | IP Logged
|
|
|
Is that the 301 redirect code? It's not working for me.
|
| Back to Top |
|
| |
Anton Admin Group

Joined: 30 January 2007 Location: Ukraine
Online Status: Offline Posts: 10520
|
| Posted: 18 November 2011 at 4:48am | IP Logged
|
|
|
"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
Online Status: Offline Posts: 5
|
| Posted: 22 November 2011 at 1:02pm | IP Logged
|
|
|
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
Online Status: Offline Posts: 5
|
| Posted: 22 November 2011 at 4:09pm | IP Logged
|
|
|
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
Online Status: Offline Posts: 10520
|
| Posted: 23 November 2011 at 2:53am | IP Logged
|
|
|
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
Online Status: Offline Posts: 5
|
| Posted: 23 November 2011 at 11:49am | IP Logged
|
|
|
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
Online Status: Offline Posts: 10520
|
| Posted: 25 November 2011 at 3:56am | IP Logged
|
|
|
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 |
|
| |