htaccess syntax is tricky
The following is a web design question for the gurus of Apache server:
One of the most common ways people find my blog is through Google Image Search. It has taken the keywords used to tag my images, as well as the pagerank of the site, and made me a prominent hit for many search terms. The trouble is, when I moved to WordPress, I broke all the links. They have not yet grown back.
Most of the hits are for archive pages for the old blog. For example, someone looking for photos of Oxford might be sent to:
http://www.sindark.com/archive/2006_01_01_sibilant_archive.html
Now, that page still exists. It is at:
http://www.sindark.com/blogger/archive/2006_01_01_sibilant_archive.html
Ideally, the person should be sent to the new post page in the WordPress architecture, but sending them to the new location of the Blogger archive page is better than dumping them into a 404 File Not Found screen.
How can I edit my htaccess file so that anyone looking for:
Xyear_Xmonth_Xday_sibilant_archive.html
will be sent to
/blogger/archive/Xyear_Xmonth_Xday_sibilant_archive.html
Of course, this is a temporary fix until Google finally understands the new architecture of my site.
September 18th, 2006 at 10:11 pm
This is now an AskMeFi post. I am getting my $5 worth.
September 18th, 2006 at 10:29 pm
RTFM and stop capitalizing off the superior knowledge of well-meaning strangers.
September 19th, 2006 at 8:11 am
Working with htaccess is beyond what my brain can manage at the moment. I will take another stab at it tomorrow.
September 20th, 2006 at 8:16 pm
Try using a permanent redirect rather than just rewriting. How about something like this as the first rewrite rule in .htaccess?
RewriteRule ^archive/([0-9]{4}_[0-9]{2}_[0-9]{2}_[a-z0-9_-]+\.html) $ /blogger/archive/$1 [R=301,L]
(I’ve not checked or tested that so there may be mistakes)
September 24th, 2006 at 9:55 pm
I have added that code to my htaccess file and it seems to work. As always, please report any errors to the bug thread.
November 28th, 2006 at 6:14 pm
Stupid htaccess tricks: useful.