• Resolved rgnagiev

    (@rgnagiev)


    WordPress version is 4.7.4.
    MultilingualPress plugin version is 2.5.4.

    I have two sites within my installation: my-website.com and ru.my-website.com.
    The only installed plugin is MultilingualPress.
    The only enabled feature is HTTP Redirect.
    The plugin is installed and Network Activated.
    In Settings > Language Manager I chose two languages – English en_US (set to 10) and Russian ru_RU (set to 10 also); all other languages are disabled.
    For two my websites mentioned above I set up corresponding languages in their Settings, and then in Network Dahboard > Sites > All Sites > <website> > Edit > MultilingualPress. I also ticked flags for Relationships and Redirection.

    The netwrok installation mode is sub-domains.
    This is my .htaccess

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    I would be grateful for any thougts why the feature might not work and how to track down what’s exactly wrong.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    first of all, the .htaccess looks good – just as provided by WordPress.

    I assume by “doesn’t work” you mean no matter what browser (settings) you are visiting the site with, you always end up at the URL that you initially requested, right?

    Are you a developer? Did you try debugging/logging what is happening in both the redirection condition logic and the redirection logic?

    Also, is there some sort of server-side caching in place?

    Cheers,
    Thorsten

    Thread Starter rgnagiev

    (@rgnagiev)

    Hello, Thorsten!
    Thank you for a prompt reply!

    The problem is SOLVED now.

    Description of the solution:
    I deleted the whole WordPress installation and started over again from scratch, performing all setup steps one after another to figure out where redirection stops functioning.
    I installed WordPress in multisite subdomain mode, created another site on ‘ru.’ subdomain, installed MultilingualPress plugin and chose languages (with their priorities equal to 10) and relationships between my two websites. So far everything worked Ok.
    The problem appears during theme customization, right after I set up ‘Static Front Page’ parameter of my theme to a dedicated page named ‘Home’. The theme is ParallaxSome made by AccessPress Themes, to be clear.
    To achieve desired behaviour (redirection of visitors to appropriate language frontpage) I went to ‘Pages > Home > Edit > Change relationship’ of my main site, chose ‘Select existing post’ radio button and unambiguously stated relationship to home page of another my site (named ‘home’ in my case).

    So, the plugin had been working correctly all the time, yet some setup was needed ??

    To stay consistent, below are answers to the questions you asked.

    Yes, exactly right – I’m using a default WordPress .htaccess file for multisite subdomain installation. Later I figured out that my web hosting provider added a few lines to it for more convenient access to cPanel via my domain name, but those lines doesn’t interfere with ‘HTTP Redirect’ function of MultilingualPress.

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule ^ - [L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule ^(.*\.php)$ $1 [L]
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteRule . index.php [L]

    I assume by “doesn’t work” you mean no matter what browser (settings) you are visiting the site with, you always end up at the URL that you initially requested, right?

    Your assumption is totally correct ??

    I enabled WordPress functions ‘WP_DEBUG’ and ‘WP_DEBUG_LOG’ in my wp-congig.php to see any issues overall, but debug.log remains empty.

    I did not set up any sort of server-side caching, so, I suppose, it’s disabled.

    With your permission, I’ll just leave this long-read with hope that it may help someone struggling against same trouble.

    Kind regards,
    Ruslan

    Hi Ruslan,

    good that it’s now working for you.

    Also, thanks a lot for the detailed response, which is for sure helpful for one or another.

    Have a nice day!
    Thorsten

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘‘HTTP Redirect’ feature doesn’t work’ is closed to new replies.