Support » Plugins » Hacks » language subdomain htaccess

  • Resolved MatthijsdeGraaf


    Hi all,

    I have problems creating a .htaccess file that directs the language subdomain to the main page. For instance:,,,

    I want to serve these pages the same user generated content (so a MU installation is -I think- not an option), but I want the page to be translated accordingly and serve some language based content.

    Does anyone know if it is possible to show the user the main page (which is currently and send a POST/GET to PHP letting the code know that the user is currently on the * page? It is important that the subdomain is not rewritten to something like but stays

    I hope my question is clear.

    Thanks in Advance,

Viewing 3 replies - 1 through 3 (of 3 total)
  • You could route all subdomains to your wordpress directory – via the server settings in your hosting backend, not with some .htaccess directives.
    You then could detect a subdomain/language like this (though this might only work for oneWord.domain.tld and not

    $tmp        = explode( '.', $_SERVER['HTTP_HOST'] );
    $subdomain  = strtoupper(
      array_shift( $tmp )
    switch( $subdomain ) {
      case 'DE':
        $lang = 'DE';
      case 'FR':
        $lang = 'FR';
      case 'NL':
        $lang = 'NL';
        $lang = 'EN';
    if( !defined( 'LANGUAGE' ) ) {
      define( 'LANGUAGE', $lang );

    This way you could check if( LANGUAGE == 'NL' )... whenever you need to.
    Depending on when that will be you might even put this code into your wp-config.php

    Thank you very much for your response Chris – let me give that a try

    That worked! Again, thank you very much Chris

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘language subdomain htaccess’ is closed to new replies.