Redirecting old pages to new friendly URLS

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 4
Joined: 13 Apr 2012, 09:27

Redirecting old pages to new friendly URLS

13 Apr 2012, 09:33

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

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Redirecting old pages to new friendly URLS

13 Apr 2012, 10:21

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:
Code: Select all
RewriteRule ^default\.asp$ / [NC,R-301,L]
RewriteRule ^$ /default.asp [NC,L]


Regards
Andrew

User avatar
Posts: 4
Joined: 13 Apr 2012, 09:27

Re: Redirecting old pages to new friendly URLS

13 Apr 2012, 10:51

Many Thanks.

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?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Redirecting old pages to new friendly URLS

16 Apr 2012, 18:57

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

User avatar
Posts: 4
Joined: 13 Apr 2012, 09:27

Re: Redirecting old pages to new friendly URLS

16 Apr 2012, 20:16

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?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: Redirecting old pages to new friendly URLS

17 Apr 2012, 06:37

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

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 3 guests