Renaming files on the entire site....

| | Comments (0) | TrackBacks (0)

Categories:

Earlier today, I implemented a neat tool: mt-refsearch, which looks at the referer that directs people to this site and does something with that info - hi-lights the search info. You can check it out here and choose the fourth link (the one to my site). The problem with that is that it's a PHP script, so I had to have it load as a PHP script. Since pretty much the entire site is setup as server-parsed HTML files, that didn't work.

My choices: don't bother, or rename just about every file on the site. I really liked the idea of adding this script to my site, so suddenly I was faced with re-arranging most of the site. Not cool.

The biggest problem this brings up is search engines - they would all be linking to the old files, which won't help things. The last thing I wanted (aside from a missing sidebar, which was also due to this re-arranging) was to then make all the links into the site stop working. What to do?

Initially I worried about rebuilding the whole site with the new code - that only took a few minutes to do. I had to rebuild all the pages (1500+ last I checked), so while that was going on, I started to dig for help. I know that you can use a .htaccess file to redirect things - I've moved other parts of the site with out disruption this way - but I wasn't sure how to pull off redirecting such a huge chunk of the site - pretty much everything in the /archives directory needed to stop looking at the .shtml file and look for a .php file. My initial search ("htaccess redirect wildcard") looked promising, but didn't work out too well - none of the suggestions actually worked for me.

Then I turned to ProNet, which is a mailing list of other MovableType users. I was led first to mamamusings: redirection solution, and then to Weblogging for Poets: weblog Links: Part 2 -- Re-weaving the Broken Web. The second link contains much of the htaccess code I had tried and not been able to use, but between the two of them, I was able to take some heavy lifting off my shoulders - creating a new index page, for example, that had the full path to the file complete with the new path to the file. I could then do some simple find/replaces to make it match the format I needed, then paste the whole thing into my htaccess file.

I'm a little worried about all those redirects in my top-level htaccess file, so I'm considering moving them, but I'm going to watch things for a few days. Because I've coded things up right from the start (I hope), I should only need to keep them in the htaccess file for a couple of weeks, until the search engines pick up that the filenames have change:

Redirect permanent /archives/2006/10/18/parenting_chronicles_moved.shtml http://adam.gerstein.net/archives/2006/10/18/parenting_chronicles_moved.php

Hopefully I'll be able to figure out how to get my wildcard search to work at some point, but I'm not overly worried - the stuff that's in there is what I need for older entries, and newer entries will be taken care of automatically by the search engines (since they already have the new filenames).

Hopefully, this info will assist someone else who's having similar troubles somewhere down the line. Or come in handy for me when I forget about all of this in about 2 days.

0 TrackBacks

Listed below are links to blogs that reference this entry: Renaming files on the entire site.....

TrackBack URL for this entry: http://adam.gerstein.net/cgi-bin/MT-4.1-en/mt-tb.cgi/1417

Leave a comment

Site Badges

Listed on BlogShares
View Adam Gerstein's profile on LinkedIn
Apple Computer
Powered by Ecto
Powered by MovableType
Feedburner
Project HoneyPot
Adam Gerstein
Add to My Yahoo!
www.blogwise.com
slashdot.org
gotfuturama.com
Blogarama - The Blog Directory
View My Portfolio
Valid XHTML 1.0 Transitional
meetup.com

Helping to support this site:

Creative Commons License
This weblog is licensed under a Creative Commons License.

About this Entry

This page contains a single entry by Adam published on October 21, 2006 10:19 AM.

Parenting Chronicles moved was the previous entry in this blog.

It's all Rudi's fault is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

May 2008

SMTWTFS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

WebCam

webcam

Twitter Updates

    Recent Comments

    Helping to support this site:

    Drop Cash Campaign

    Powered by Movable Type