Forum Moderators: phranque

Message Too Old, No Replies

Probably .htaccess problem--WordPress+WPML

One domain per language, and only one WordPress installation

         

mrinterested

11:41 am on Jan 17, 2011 (gmt 0)

10+ Year Member



Hello,

I'm trying to setup WordPress with WPML plugin, which allows having multiple language with the option of separate domain per language. Unfortunately, the authors of the plugin do not provide the exact solution here (http://wpml.org/2009/04/domain-per-language-subdomains-or-language-folders/) on how to do this.

Anyway, from researching forums, etc. I've found out that the issue is with redirecting the domain, as first the domain has to be redirected in order for WPML to work. I've tried playing with .htaccess file, and my guess is that there has to be the solution with .htaccess because the second try gave me better results, although still it didn't fork.

Just to explain first: I have to domains, let's called them domain.com and domain.#*$!. I want to redirect domain.#*$! to domain.com, or, to be more specific, to the installation of WordPress (on domain.com). So there would be two languages, one for .com, another for .#*$!. The goal is to have a blog with two language, and have, for example, the following posts/pages:
(1) domain.com/about
(2) domain.#*$!/about-in-#*$!-language
(3) domain.com/2011/01/new-post
(4) domain.#*$!/2011/01/new-post-in-#*$!-language

Here's how it should work. I go to domain.com which show me default language, and when I switch to #*$! language I will be redirected to domain.#*$! (which in turn will be redirected to domain.com, but only #*$! content will be shown). Similarly, when I go to (1) address and click on #*$! language, I will be redirected to (2) address. Same for (3) address.

FIRST TRY

I first modified .htaccess as follows:


RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.#*$!
RewriteCond %{REQUEST_URI} !/(.+) [NC]
RewriteRule (.*) http://domain.com [R=301,L]
RewriteCond %{HTTP_HOST} ^domain.#*$!
RewriteCond %{REQUEST_URI} !/(.+) [NC]
RewriteRule (.*) http://domain.com [R=301,L]


Results:
+ setup of WPML works, because the plugin detect redirection (without .htaccess it doesn't work).
- when I go to domain.#*$!, I'm only redirected to domain.com, and so English version, and not #*$! is visible,
- domain.com/about works, but domain.#*$!/about doesn't, since only domain.#*$! is redirected, and so domain.#*$!/about doesn't exist.

SECOND TRY

Then (yesterday actually) I modified the file as follows:


Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^.(.+)$ [NC]
RewriteRule ^(.*)$ http://www.michaelzabinski.com/$1 [R=301,L]


Results:
+ setup works,
- domain.#*$! redirected to domain.com, but only .com content shown,
+ when I'm on domain.com/about and click on #*$! language, it goes to domain.#*$!/about-in-#*$!-language, which in turn is redirected via .htaccess on domain.#*$! to domain.com/about-in-#*$!-language, but again that doesn't exist. domain.com has only domain.com/about.

Some guys, for example here (http://forum.wpml.org/topic.php?id=315, succeeded), and I guess the problem is with redirection. The plugin works perfectly here (http://www.borderenergy.org/).

Does anyone have any suggestion as to what I'm doing wrong? Any help would be appreciated. Thanks.

Best

mrinterested

12:42 pm on Jan 17, 2011 (gmt 0)

10+ Year Member



PS I don't know why "x x x". (without spaces) was changed to "#*$!". I do apologies. I meant domain. x x x (without spaces) and language x x x (without spaces).

jdMorgan

10:23 pm on Jan 19, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What values does "x x x" actually take on?

Why are you redirecting multiple times? (This is a popular and effective form of SEO suicide.)

It appears that you're "guessing at" regular-expressions patterns -- for example "^.(.+)$" matches any single character followed by one or more instances of any character. It is unclear why this RewriteCond might be needed at all, even if the pattern were to be corrected.

Please comment your code to indicate precisely what each rule is *intended* to do.

Thanks,
Jim