Redirecting old pages to new friendly URLS
6 posts
• Page 1 of 1
Redirecting old pages to new friendly URLS
My current site has the classic ASP URLS similar to http://www.domain.com/Category.asp?CID=42 - I have setup ISAPI Rewrite and got http://www.domain.com/category/some_friendly_text/42 working it seems.
However I guess I need to 301 the old URLs onto the new (which will rewrite back to the old!) - how do people handle such things? Will I need to replace my existing pages with a 301 and then rewrite onto new versions as the URLs of these will be effectively hidden anyway?
Also how to I redirect www.domain.com/default.asp to just the site root?
Many Thanks
Chris
However I guess I need to 301 the old URLs onto the new (which will rewrite back to the old!) - how do people handle such things? Will I need to replace my existing pages with a 301 and then rewrite onto new versions as the URLs of these will be effectively hidden anyway?
Also how to I redirect www.domain.com/default.asp to just the site root?
Many Thanks
Chris
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirecting old pages to new friendly URLS
Hello,
People create sets of rules, each set consists of 2 rules: 301-redirect and rewrite. Depending on the rule you have (regexp or mapfile) you need to create an opposite to the one you have.
You redirect default.asp and rewrite it as in the following:
Regards
Andrew
People create sets of rules, each set consists of 2 rules: 301-redirect and rewrite. Depending on the rule you have (regexp or mapfile) you need to create an opposite to the one you have.
You redirect default.asp and rewrite it as in the following:
- Code: Select all
RewriteRule ^default\.asp$ / [NC,R-301,L]
RewriteRule ^$ /default.asp [NC,L]
Regards
Andrew
Re: Redirecting old pages to new friendly URLS
Many Thanks.
Should that line be? :
I just changed the dash for equal sign.
How about redirect my old parameter based URLs to the new friendly ones - I'm thinking this can only be done "in page" because I'll have no concept of the friendly part within my rewriting rules.
Is it good practive to include the L flag - should that be for all rules - i.e. find first match and then stop?
Should that line be? :
- Code: Select all
RewriteRule ^default\.asp$ / [R=301,NC]
I just changed the dash for equal sign.
How about redirect my old parameter based URLs to the new friendly ones - I'm thinking this can only be done "in page" because I'll have no concept of the friendly part within my rewriting rules.
Is it good practive to include the L flag - should that be for all rules - i.e. find first match and then stop?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirecting old pages to new friendly URLS
How about redirect my old parameter based URLs to the new friendly ones - I'm thinking this can only be done "in page" because I'll have no concept of the friendly part within my rewriting rules.
- not sure I understand, give some examples.
And yes, L-flag is highly recommended to use in each rule, unless you need some twisted logic.
Regards
Andrew
Re: Redirecting old pages to new friendly URLS
Well the site has about 2000 product pages, so it woud have been :
/Product.asp?ID=123
and so I want to have :
/Product/Friendly-product-name/123
Where Friendly-product-name is stored in my database. So I was thinking about doing a 301 redirect based on looking up the friendly name from the ID in my old page?
/Product.asp?ID=123
and so I want to have :
/Product/Friendly-product-name/123
Where Friendly-product-name is stored in my database. So I was thinking about doing a 301 redirect based on looking up the friendly name from the ID in my old page?
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: Redirecting old pages to new friendly URLS
Well, take a look at "Comprehensive mapfiles" in our FAQ.
ISAPI_Rewrite, unlike Ape, does not work with databases and allows only mapfiles.
Regards
Andrew
ISAPI_Rewrite, unlike Ape, does not work with databases and allows only mapfiles.
Regards
Andrew
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests