Post #279,522
3/25/07 7:38:34 PM
|
Here's the short version
I haven't read the article crazy linked on setting it up, and it depends on the webserver anyway, but I'll assume Apache. The basic idea is that you have a file with a set of regular expressions that identify the old URLs and munge them into the new URLs. The new URLs are returned to the browser with a code that says, "Don't use that URL, use this one instead."
Anything remotely automated will pick it up and stop hitting the old ones. If you think it's real people, then you'll want to redirect to an interstitial that says, "That page has moved, here's the new URL, you'll be automatically redirected in 10 seconds."
The important part is that this all happens in the webserver, before it hits your DB. And it's just doing a regex match/replace, not a complex lookup. (The file can have multiple regexes.)
===
Kip Hawley is still an idiot.
===
Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats]. [link|http://DocHope.com|http://DocHope.com]
|
Post #279,525
3/25/07 7:56:13 PM
|
Oh, OK...
That sounds like what I want, then. So essentially it's just one file with a series of links pointing to other links? That's easier to do than I originally feared... as soon as I read up on the proper format.
"We are all born originals -- why is it so many of us die copies?" - Edward Young
|
Post #279,550
3/25/07 11:04:19 PM
|
124K - eek!
I created a 301 redirect list of all my help desk images and placed that in my .htaccess file...
Redirect 301 /comics/hd20010306.png [link|http://files/comics/hd/hd20010306.png|http://files/comics/hd/hd20010306.png] etc etc
1400 lines later, the htaccess file is now 124.7 k! From an original 5.7k.
I'm having trouble rationalizing loading that up into my live site. That's an awfully big file.
"We are all born originals -- why is it so many of us die copies?" - Edward Young
|
Post #279,556
3/26/07 12:27:16 AM
|
I wouldn't sweat it.
We have a 62Kb httpd.conf file on our main website. And it's big enough to need it's own load-balanced configuration with 10 web servers.
Wade.
Is it enough to love Is it enough to breathe Somebody rip my heart out And leave me here to bleed
| | Is it enough to die Somebody save my life I'd rather be Anything but Ordinary Please
|
-- "Anything but Ordinary" by Avril Lavigne. | · my · · [link|http://staticsan.livejournal.com/|blog] · · [link|http://yceran.org/|website] · |
|
Post #279,559
3/26/07 12:54:39 AM
|
oh, that's right...
.htaccess is read by the SERVER, not by browsers.
Heh.
I knew that. :)
"We are all born originals -- why is it so many of us die copies?" - Edward Young
|
Post #279,595
3/26/07 12:58:16 PM
|
RedirectMatch?
I think the way to cut down on the size of this file is to use RedirectMatch instead of Redirect... RedirectMatch lets you use wildcards.
Alas, I'm not quite familiar with how it's supposed to work, so this is a guess:
move all png files starting with "hd" from /comics to /files/comics/hd:
RedirectMatch 301 /comics/hd(.*)\\.png$ [link|http://ubersoft.net/files/comics/hd$1|http://ubersoft.net/files/comics/hd$1]
... does that look right?
"We are all born originals -- why is it so many of us die copies?" - Edward Young
|
Post #279,597
3/26/07 1:00:56 PM
|
you might not even need the...
http://ubersoft.net part.
Though I haven't done any mass relocations like that ever.
-- [link|mailto:greg@gregfolkert.net|greg], [link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwetheyFreedom is not FREE. Yeah, but 10s of Trillions of US Dollars? SELECT * FROM scog WHERE ethics > 0;
0 rows returned.
|
Post #279,599
3/26/07 1:05:00 PM
|
But are the wildcards used correctly?
That's the part I'm nervous about.
Also, if I wanted to redirect a number of files to a specific page:
"all html files in the 'd' directory starting with 'hd1996' to '[link|http://ubersoft.net/comic/hd/archives/1996'|http://ubersoft.net/...hd/archives/1996'] "
would I just drop the "$1", i.e.
RedirectMatch 301 /d/hd1996(.*)\\.html$ [link|http://ubersoft.net/comic/hd/archives/1996|http://ubersoft.net/.../hd/archives/1996]
... and if I did that would it be appropriate to use the 301, or would it be more accurate to use one of the other redirect #'s?
I'm pretty new at this... the stuff I've googled doesn't quite cover it, or the conversations and explanations assume a much higher familiarity with the subject than I have... and the apache documentation, unfortunately, is rather like reading sanskrit.
"We are all born originals -- why is it so many of us die copies?" - Edward Young
|
Post #279,601
3/26/07 1:16:02 PM
|
Looks like it. According to current Apache docs:
[link|http://httpd.apache.org/docs/1.3/mod/mod_alias.html#redirectmatch|apache 1.3 mod_alias docs] RedirectMatch (.*)\\.gif$ [link|http://www.anotherserver.com$1.jpg|http://www.anotherserver.com$1.jpg] Just add the parts you need. But it appears you are good. Nothing a test wouldn't fix.
-- [link|mailto:greg@gregfolkert.net|greg], [link|http://www.iwethey.org/ed_curry|REMEMBER ED CURRY!] @ iwetheyFreedom is not FREE. Yeah, but 10s of Trillions of US Dollars? SELECT * FROM scog WHERE ethics > 0;
0 rows returned.
|