Mostly Harmless

Archive for the ‘ATPP’ tag

.htaccess fix for machine translation  

The current version of ATPP is 5.1 and it works really well. But occasionally I get speed bumps from Babelfish and Google translation engines so I end up turning it off for a while.

Without the plugin, when someone goes to the translated version of a posting, they get redirected to the home page.

For example the German pages for Andre’s trip to Disneyland is

http://wp.dembowski.net/2008/01/30/andres-trip-to-disneyland/de/

When I turn off the plugin users get sent to

http://wp.dembowski.net/

Here is where .htaccess comes to the rescue. By adding lines at the top of my .htaccess file I can send the request for a translated post to the English version:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
RewriteRule ^de/ http://wp.dembowski.net/ [R=302,L]
RewriteRule ^zh/ http://wp.dembowski.net/ [R=302,L]
RewriteRule ^ko/ http://wp.dembowski.net/ [R=302,L]
RewriteRule ^ja/ http://wp.dembowski.net/ [R=302,L]
RewriteRule ^pt/ http://wp.dembowski.net/ [R=302,L]
RewriteRule ^it/ http://wp.dembowski.net/ [R=302,L]
RewriteRule ^es/ http://wp.dembowski.net/ [R=302,L]
RewriteRule ^(.*)/de/ http://wp.dembowski.net/$1/ [R=302,L]
RewriteRule ^(.*)/zh/ http://wp.dembowski.net/$1/ [R=302,L]
RewriteRule ^(.*)/ko/ http://wp.dembowski.net/$1/ [R=302,L]
RewriteRule ^(.*)/ja/ http://wp.dembowski.net/$1/ [R=302,L]
RewriteRule ^(.*)/pt/ http://wp.dembowski.net/$1/ [R=302,L]
RewriteRule ^(.*)/it/ http://wp.dembowski.net/$1/ [R=302,L]
RewriteRule ^(.*)/es/ http://wp.dembowski.net/$1/ [R=302,L]

The request from /some/url/here/de/ results in the Apache server sending back a 302 temporarily moved to the same URL minus the two letter language code.

If I have to turn off the ATPP plugin for an extended time, I can do so knowing that search engine visitors will still find the original post.

Update: added portion for languages off of the root i.e. http://wp.dembowski.net/es/ becomes http://wp.dembowski.net/

The article has

no responses yet

Written by Jan Dembowski

May 2nd, 2008 at 7:27 pm

Okay I think I got ATPP working  

I think I’ve gotten the machine translation working to a point of good stability. Meaning my MySQL config is not killing the box with requests, caching seems to be working fine.

Right now I have 65 translated pages in my database. When I encounter one that is munged (meaning the database timed out) I manually delete that page in the ATPP cache and only that page. So fare so good.

I combined ATPP with WP-CACHE and all seems right in the world.

The article has

no responses yet

Written by Jan Dembowski

November 6th, 2007 at 10:59 am

Posted in Software

Tagged with , ,

Bad Behavior has blocked 90 access attempts in the last 7 days.