This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Our next available supporter will start replying to tickets in about 9.38 hours from now. Thank you for your understanding.

This thread is resolved. Here is a description of the problem and solution.

Problem:Arabic as second language homepage on a mobile device issue

Solution:SiteGround plugin was causing a 301 redirection

Relevant Documentation:

This topic contains 16 replies, has 2 voices.

Last updated by ahmedM-19 5 months ago.

Assigned support staff: Bobby.

Author Posts
April 9, 2019 at 7:24 pm #3570275

ahmedM-19

I am trying to: open homepage from mobile device but failed

Link to a page where the issue can be seen: felguide.com/ar

I expected to see: the translated homepage is not open

Instead, I got:

April 9, 2019 at 7:44 pm #3570377

ahmedM-19

hidden link
from mobile device

April 9, 2019 at 9:19 pm #3570907

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

there is a redirect happening which seems to be the cause of this problem.

/ar/home => /ar/

is it possible to remove the redirect and remove the /home/ from the URL ?

hidden link

HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 09 Apr 2019 21:18:19 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
X-Redirect-By: WordPress
Set-Cookie: PHPSESSID=95a8f04506702c77c7f66712a353d6f8; path=/
Set-Cookie: _wcmp_user_cookie_0=wcmp_cookie5cad0c1b9ab3a; expires=Wed, 08-Apr-2020 21:18:19 GMT; Max-Age=31536000; path=/; secure
Set-Cookie: pmpro_visit=1; path=/
Location: hidden link
Host-Header: 192fc2e7e50945beb8231a492d6a8024
X-Proxy-Cache: MISS
alt-svc: quic=":443"; ma=86400; v="43,39"

hidden link

April 10, 2019 at 6:42 am #3572871

ahmedM-19

Hi Booby,
Thank you for your response.

Tell me what to do exactly and I will do it.

Thanks
Dodd

April 10, 2019 at 7:17 am #3573027

ahmedM-19

Hi Bobby,

I can see the home page in desktop have this url (hidden link)
while in mobile have this one (hidden link) and i don't know where in WPML settings I can change it.

Waiting for your feedback.

April 10, 2019 at 6:06 pm #3580095

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

On the desktop this redirection happens as well but for some reason the desktop is handling it better than the mobile.

1. Please go to WPML->Languages-> and share with me a screenshot of your current language url format settings

2. go to WP->Settings-> General and share with me a screenshot of your URL settings from there as well

3.Are you using any redirect plugins ? and is WordPress installed within a directory ? (ex. home )

April 10, 2019 at 9:31 pm #3581523

ahmedM-19

1- WPML->Languages-> hidden link
2- WP->Settings-> hidden link
3- No redirect plugins

April 11, 2019 at 12:30 am #3582245

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

If possible i would like to take a closer look at your backend

**Before we proceed I recommend to please take FULL BACKUP of your database and your website.**
I often use the Duplicator plugin for this purpose See: http://wordpress.org/plugins/duplicator/

I would like to request temporary access (wp-admin and FTP) to your site

You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you will enter is private which means only you and I can see and have access to it.

April 11, 2019 at 8:09 pm #3592645

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

i can verify that this redirect is being caused by your theme.

After some tests if you switch your theme to a default WP theme the redirect will not happen on the mobile site.

from our side your wp_options in the database , and settings along with your .htaccess file all checkout.

if possible please contact your host provider as they should be able to detect any redirects and let me know their feedback on the redirects on your site.

additionally you might want to contact the theme developers as well or examine your theme options in case some settings are doing this.

also examine the screenshot i am sharing as some requirements are disabled on your server that your theme is requiring.

April 13, 2019 at 4:45 am #3603539

ahmedM-19

Hi Bobby,

I contact my hosting "SiteGround" and this is their response:

The cURL request toward the website shows no redirect.

Waiting for your feedback

Thank you.

Dodd

April 15, 2019 at 6:14 am #3609941

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi Dodd,

i am currently trying to test the front end of your site but i am currently getting an error 500

additionally after taking a look at your htaccess folder i can see that there is an en/ rewrite added.

please review the following documentation
=> https://wpml.org/errata/htaccess-is-rewritten-with-language-folder/

additionally as i did further test this on our local enviroment , changing your theme to a standard WP theme resolves the redirection issue on the mobile which suggests that there is a possibility there is some redirection added within your theme .

please try the steps in the errata above and let me know your results

April 16, 2019 at 4:54 am #3618177

ahmedM-19

Hi Bobby.. Thank you for your response..

I contacted the host provider for the error 500 and here is his response: ---I noticed that you changed the rewrite base in your htaccess file to /en. Since your site is located in public_html that created the 500 server error and when I remove that part /en the site is working. My best advise will be to contact the theme or plugin developer to ask them for alternative solution as it wasn't the correct one----

When I review WPML options, I found this option: Language name added as a parameter (hidden link - Arabic). Is this helping to solve the issue Bobby !!!!

April 16, 2019 at 5:04 am #3618257

ahmedM-19

I read the documentation you sent and here is my question:
""flushing rewrite rules is a server-expensive operation and extra care should be taken.""
Does this mean flushing cache!!!

Thank you
Dodd

April 16, 2019 at 4:43 pm #3624125

Bobby
Supporter

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi There,

within your .htaccess file there was a rewrite with the en/ which indeed as your host said must have been causing this behavior

The documentation above explains why this is happening and the code resolves this issue.

i have currently added this code within your child theme functions.php and after testing on my phone it seems to be working as expected now.

This is the WP Codex for the flushing of rewrite rules
https://codex.wordpress.org/Function_Reference/flush_rewrite_rules

April 17, 2019 at 5:24 am #3627187

ahmedM-19

i have currently added this code within your child theme functions.php and after testing on my phone it seems to be working as expected now.

Added where!!! I tested it and the issue is not resolved yet.
Please clarify.
Thanks