This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: 301 Redirect Old Map file to new map file
Author
Message |
shiplett
Newbie


Joined: 13 December 2011
Posts: 6
Posted: 13 December 2011 at 10:26pm

I have a client who has been using a map file for while
now, so all of those urls are indexed.

Now they would like to change some of those urls, to
improve SEO.

How do I ensure that prior created links to earlier urls
(created based on a map file), now redirect to the new
urls?

As an example: the prior list of urls looked like:

january 1
february 2
march 3

etc. etc.

The new one will look like:

events-in-january 1
events-in-february 2

etc. etc.

So, how to I redirect from the links created by the
former map file, to links created by the current map
file?

Any help would be appreciated,
Thanks,
Alex
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 14 December 2011 at 5:12am

You just create a new rule for new URLs and edit an old rule.
Idea is:
1) you edit old rule to make redirect, not rewrite.
2) you change mapfile:

Code:
january   events-in-january
february events-in-february


regards
Andrew



Back to Top
 
shiplett
Newbie


Joined: 13 December 2011
Posts: 6
Posted: 14 December 2011 at 9:53am

Okay . . . so I don't think i'm clear on the concept.

Our direct urls look like /chapter.asp?chapterid=1234

The mapfile then looks like:

january 1234

So the resulting url would be /january displaying content
from /chapter.asp?chapterid=1234.

Now, we want to change that to be:

events-in-january 1234

and have both /january, and /chapter.asp?chapterid=1234
redirect to the new url.

So, the existing rule - which rewrites the URL already,
should redirect to what?

These are the existing rewrite rules . . . .
Code:

RewriteMap map_chapter txt:rewrite_chapter.txt
RewriteMap map_subchapter txt:rewrite_subchapter.txt
RewriteRule ^([A-Za-z0-9-]+)/?$ /chapter.asp?
id=${map_chapter:$1}
RewriteRule ^([A-Za-z0-9-]+)/?([0-9]+)/?$ /chapter.asp?
id=${map_chapter:$1}&p=$2
RewriteRule ^([A-Za-z0-9-]+)/?([A-Za-z-]+)/?$
/chapter.asp?id=${map_chapter:$1}&pw=$2


Thank you for your help,
Alex

Edited by shiplett - 14 December 2011 at 9:54am
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 16 December 2011 at 6:31am

Well,

my idea is still the same. I'll try to put in this way:

1) Let the rule stay as it is.
2) Replace existing mapfile's content with
Code:
events-in-january 123
events-in-february 1234

This will give you new urls that load content from the old source
3) Create a similar redirect rule with certain changes, so that it'd use other mapfile
Code:
february events-in-february
january events-in-january

this will redirect old-google-indexed urls to new onew, which will get content from the same place

Regards
Andrew
Back to Top
 
shiplett
Newbie


Joined: 13 December 2011
Posts: 6
Posted: 18 December 2011 at 9:39pm

UPDATE:

Nevermind, I think I've figured it out. This rule, prior
to the old url rewrite/redirect appears to work:

RewriteCond ${new_map_chapter:$1|NOT_FOUND} !NOT_FOUND

-------------
Okay, so I've got a handle on the map files, which seems
clear enough. But the rule that I have is redirecting
the old URL to the new URL, which is good, but then
continues by attempting to redirect the new URL,
ultimately just ending up on the home page.

The rules are:

Code:
RewriteRule ^([A-Za-z0-9-]+)/?$
/${new_map_chapter:$1} [NC,R=301,L]
RewriteRule ^([A-Za-z0-9-]+)/?$ /chapter.asp?
id=${map_chapter:$1} [NC,L]


I'm sorry to be so dense about this, but any help would
be appreciated. Your help is already appreciated, thank
you!

Alex
Code:
RewriteCond ${new_map_chapter:$1|NOT_FOUND}
!NOT_FOUND
Code:
RewriteCond
${new_map_chapter:$1|NOT_FOUND} !NOT_FOUND

Code:
RewriteCond ${new_map_chapter:$1|NOT_FOUND}
!NOT_FOUND


Edited by shiplett - 18 December 2011 at 9:51pm
Back to Top
 
shiplett
Newbie


Joined: 13 December 2011
Posts: 6
Posted: 18 December 2011 at 10:12pm

So now I can't get the second level links to redirect.

i.e. /information/visitor-convention-center SHOULD
redirectto /information/visitors

but does not.

Can you help me again?

I really appreciate this.
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 19 December 2011 at 5:23am

In case you want to have both types working, than you need to edit the regexp pattern from ([A-Za-z0-9-]+)/? to ([A-Za-z0-9-]+(/[A-Za-z0-9-]+)?/?).
Try it. In case it wont work we might need to create one more rule like:

RewriteRule ^([A-Za-z0-9-]+)/[A-Za-z0-9-]+)/?$ /${new_map_chapter:$1} [NC,R=301,L]

Regards
Andrew
Back to Top
 
shiplett
Newbie


Joined: 13 December 2011
Posts: 6
Posted: 05 January 2012 at 8:56pm

Ok. So I have researched and messed around to know more
about what I am asking to do.

Here is what I want to do:

Have all defined urls redirect to new urls - so in the
old map file

event-in-january 123

in re-map file:

january event-in-january

But I also want any existing sub-directories to map to
the new directory, so:

/january/snow-dive

should now redirect to

/event-in-january/snow-dive

however, the above URL is not listed in the map file.
What I am looking to do is replace that first level
(january/) with the new one (event-in-january/), matching
only that part of the url.

Is this possible? I think it is, and I am still trying
to come up with the solution myself, but regex is not my
strong suit.

Any help would be appreciated, as all help to this point
has been!
thanks,
alex
Back to Top
 
shiplett
Newbie


Joined: 13 December 2011
Posts: 6
Posted: 05 January 2012 at 9:50pm

Booya!

I got it!

Here are the rules that I have:

Code:
RewriteCond ${new_map_chapter:$1|NOT_FOUND}
!NOT_FOUND RewriteRule ^([A-Za-z0-9-]+)/?$
/${new_map_chapter:$1}/ [NC,R=301] RewriteCond
${new_map_chapter:$1|NOT_FOUND} !NOT_FOUND RewriteRule
^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$
/${new_map_chapter:$1}/$2/ [NC,R=301]


And then the old rules, pulling the content from the
dynamic pages to the rewritten urls.
Back to Top
 

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

Printable version Printable version