Dynamic URL rewrites
5 posts
• Page 1 of 1
- DesignsOnline
- Posts: 14
- Joined: 27 Apr 2013, 17:11
Dynamic URL rewrites
I have rules in place already that convert DYNAMIC URLs like productdetails.asp?subcatagoryid=123&productid=22
to SEO compatible urls like C123-CatName-P22-Productname.asp
But I have made some big changes in the database recently and need to redirect certain specific urls that no longer exist in the database and now just give errors when you visit them:
for example:
ProductDetails.asp?subcatagoryid=244&ProductID=1177
I would like to redirect everything that has subcatagoryid=244 to newurl.asp regardless of anything else that comes after in the url.
How would I create this rule and should I place it above the general rules that rewrite the other URLs?
to SEO compatible urls like C123-CatName-P22-Productname.asp
But I have made some big changes in the database recently and need to redirect certain specific urls that no longer exist in the database and now just give errors when you visit them:
for example:
ProductDetails.asp?subcatagoryid=244&ProductID=1177
I would like to redirect everything that has subcatagoryid=244 to newurl.asp regardless of anything else that comes after in the url.
How would I create this rule and should I place it above the general rules that rewrite the other URLs?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Dynamic URL rewrites
Hello,
You would put this rule at the top of your config file and use the following syntax:
Regards
Andrew
You would put this rule at the top of your config file and use the following syntax:
- Code: Select all
[ISAPI_Rewrite]
RewriteRule ProductDetails\.asp?subcatagoryid=244.* http\://www\.site\.com/newurl\.asp [I,RP]
Regards
Andrew
- DesignsOnline
- Posts: 14
- Joined: 27 Apr 2013, 17:11
Re: Dynamic URL rewrites
Hi there, thank you for your reply. However that didnt work.
It didnt do anything for some reason.
Here is my httpd.ini file with the working rules that are already in it:
It didnt do anything for some reason.
Here is my httpd.ini file with the working rules that are already in it:
- Code: Select all
[ISAPI_Rewrite]
#Images & Css
RewriteRule .*\.(?:css|jpg|png|js|gif) $0
#project rules
RewriteRule /P(\d+).*\-C(\d+)\.asp /productdetails.asp\?ProductID=$1&SubCatagoryID=$2 [I,L]
RewriteRule /P(\d+)-pg(\d+)(.*)\.asp /productdetails.asp\?ProductID=$1 [I,L]
RewriteRule /P(\d+)(.*)\.asp /productdetails.asp\?ProductID=$1 [I,L]
#category rules
RewriteRule /d(\d+)-pg(\d+)(.*?)/? /Products.asp\?SubCatagoryID=$1 [I,RP,L]
RewriteRule /d(\d+)(.*?)/? /Products.asp\?SubCatagoryID=$1 [I,L]
#testimonial rules
RewriteRule /T(\d+)-pg(\d+)(.*)\.asp /Testimonialdetails.asp\?TestimonialID=$1 [I,L]
RewriteRule /T(\d+)(.*)\.asp /Testimonialdetails.asp\?TestimonialID=$1 [I,L]
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Dynamic URL rewrites
I'm sorry, try:
Regards
Andrew
- Code: Select all
RewriteRule /ProductDetails\.asp\?subcatagoryid=244.* /newurl\.asp [I,RP]
Regards
Andrew
- DesignsOnline
- Posts: 14
- Joined: 27 Apr 2013, 17:11
Re: Dynamic URL rewrites
That did it, great thanks for your help...
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 0 guests