Forum Moderators: phranque

Message Too Old, No Replies

Redirect help please!

         

emsix

6:58 pm on Oct 15, 2009 (gmt 0)

10+ Year Member



Hi,

We have a blog that has about 5,000 posts. We recently switched from the movable type platform to Wordpress.

We didn't plan very well and our URL structure has changed. We are months after the change and the SEO damage is done and I'm not concerned about that any longer. I am concerned about links that exist in directories and bookmarks people have.

I don't think I can populate my .htaccess with 5000 301 redirects from the old pages to the new pages (I do have a file that has a list of off the old url's and their corresponding new url).

So I need the best method for redirect the 5000 old url's to the corresponding new url. I'm hoping someone can point me in the right direction.

The old url format is:
[ourdomain.com...]

and the new url format is:
[ourdomain.com...]

I can't seem to figure out a method to use pattern matching, and am just left with this one-to-one lookup table.

Any ideas would be great!

Thanks.

jdMorgan

7:58 pm on Oct 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because the old URL does not contain any of the information needed to divine or 'build' the new URL, you will have to use a script that has access to your database (or a database of some sort) to do this redirection.

That means you can either build the redirect function into your blog script, add a "wrapper" script around your blog script (that redirects if needed, but otherwise just executes the blog script), or you can write a small PERL program to look up the old URL in a database and return the new URL, and invoke that in httpd.conf or .htaccess using a RewriteMap, or you can build a flat RewriteMap lookup file without using a PERL script. But do note that defining a RewriteMap requires server config-level access rights.

Other than those methods, it's either 500 discrete redirects, or just give up on the links to those old posts...

Jim

g1smd

9:23 pm on Oct 15, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Rewrite (NOT redirect) all requests for old-format URLs to a single simple script that examines the request, and then sends two headers, one saying status 301 and the other with the new URL that the browser needs to request.