1

Situation

My client has a webshop in 2 languages:
- my-website.be (Dutch + French)
- my-website.nl (Dutch)

I have to remake the /blog for these 3 languages using Wordpress.
I have no access to the main website and server, so this has to be done with reverse proxy.

Ideally this will look like this:
- my-website.be/nl-be/blog/%postname%/
- my-website.be/fr-be/blog/%postname%/
- my-website.nl/blog/%postname%/

We use WPML(pro) for translation on the website
I have to proof this is possible

The problem

I'm trying to proof this is possible with wpml + reverse proxy on my local machine using MampPro for Windows. (As I do not have real/live servers/domains available to test this) And this is not working correctly whatever I try.

The local test setup

  • Made 2 local servers for reverse proxy:
    • my-site.localbe
    • my-site.localnl
  • Made 1 local server for the blog: my-site.test
  • Set the .htaccess files in the 2 proxy domains to reverse proxy this:

my-site.localbe

<IfModule mod_rewrite.c>
    RewriteEngine On  
    RewriteRule ^nl-be/blog/(.*)$ http://my-site.test/$1 [P]  
    RewriteRule ^fr-be/blog/(.*)$ http://my-site.test/$1 [P]  
</IfModule>

my-site.localnl

<IfModule mod_rewrite.c>
    RewriteEngine On  
    RewriteRule ^blog/(.*)$ http://my-site.test/$1 [P]  
</IfModule>
  • Setup 3 languages in WPML (nl-be, fr-be, nl-nl)
  • Set the Wordpress site url to the default http://my-site.test

==> with this setup both reverse proxy domain just show the default homepage and/or subpages. There's no way to access the other languages.

What we've tried

  • Changing Wordpress wp_home and wp_siteurl to:
    /nl-be/blog (as nl-be is set as the default language in wpml)
  • Setting up wpml as "different domain for each language", but that places /nl-be/ hardcoded after each of those different domains.
    (with wp_home and wp_siteurl set as my-site.test)
  • Fiddling with proxypass settings in .htaccess (probably wrong)
  • Changing the wpml language domains hardcoded in database
  • Overwriting the server_name variable in functions.php as follows:

    $_SERVER['SERVER_NAME'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
    
  • Combinations and variations off all above.

Results

  • Mostly error 500
  • A broken .htaccess when saving permalinks
  • To much internal redirections
  • Links looking like my-site.testbe/nl-be/blog/nl-be/*
  • Styling and scripts loading from wrong domain
  • Combinations of all above

I would like to know

  • if this setup is even possible (local or on real linux servers)
  • if the mistake is in my reverse proxy / htaccess part
  • if the mistake is in configuring wordpress and wpml
  • any information that can help me solving this.

Thanks a lot, a developer in distress

Vinobe
  • 73
  • 1
  • 11

0 Answers0