• Resolved Zeliha Canderengul

    (@zelihacanderengul)


    It does not automatically redirect AMP pages to Mobile visitors for the subdomain homepage.

    My website is offered in two languages. There are pages on the main domain showing the contents of the Turkish language. In the subdomain, I add English content. So the main domain of main domain is Turkish. The https://en subdomain is in English. I am creating this transformation from a single Admin panel using the Polylang plugin.

    My question is: When I enable the Automatically redirect pages to mobile visitors option of my website’s AMP plugin, the subdomain’s home page does not open. So instead of en.maindomain/amp/ it redirects to the main domain page. This is an important problem. Whereas I want all pages of my website to be automatically redirected to an AMP version.

    Since this is an important issue, I have disabled the automatic redirect on the site for now. Because when I disable the setting, it is possible to switch to the en.maindomain/amp/ page. However, this is not provided automatically. Do you have a definitive solution to the problem? This is a routing issue of the plugin. Please update your codes.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Merhaba. En degilde ozmyo/en/ seklinde yaparsaniz alan adinizdan domain otoritesi ile fayda saglarsiniz

    Thanks for reaching out. We’d be happy to check this from our side. Before doing so can you share your current Polylang configuration (Language > Settings > URL modifications). A screenshot of your current configuration would be useful.

    Thread Starter Zeliha Canderengul

    (@zelihacanderengul)

    @cemsid ozmyo.com/en ?eklinde bir yap? istemiyorum. O yüzden onu tercih etmedim. Domain otoritesi i?in bu gereklilik de?ildir.

    Thread Starter Zeliha Canderengul

    (@zelihacanderengul)

    Thanks for the update and apologies for the delay in responding. I’m just setting up a site similar to your own at present, to test using a subdomain configuration. Please allow me some time before checking this and reporting back to you. I expect this will be at some stage tomorrow.

    Just to keep you updated on this issue I don’t see any issues with polylang with subpaths using the AMP plugin although I’m having difficulty setting up different domains using the plugin.

    Can you confirm you’re using the same WordPress install or using a multisite domain mapping setup?

    Thread Starter Zeliha Canderengul

    (@zelihacanderengul)

    @jamesosborne After adding the Polylang plugin, activate the IKNOW theme. Add a static page for the home page of the website. (The homepage should be a static page, not as a blog archives.) Do the same for the English language. So: add a homepage for both languages of your website. When you try in this way, you will see that the subdomain is not opened and is directed to the main domain.

    Settins / Reading / Your homepage displays / A static page (select below)

    Exmple: https://ozmyo.com/wp-content/uploads/2021/06/lang2.jpg

    Thanks for the update and instructions for a similar setup to your own. What I’m curious to know is how you applied a redirect from your en.ozmyo.com to your only WordPress install. Did you make changes to your .htaccess file or apply redirects elsewhere from the language based subdomains?

    Thread Starter Zeliha Canderengul

    (@zelihacanderengul)

    @jamesosborne I redirected it to /public_html/ozmyo.com/ so that the en.subdomain.com subdomain could point to the main domain. I did this via cPanel. I didn’t edit an htaccess. Thus, en.ozmyo.com, which you point to the main domain directory, is operational.

    Thanks for sharing. I’ve setup the same environment as your own although I’m having trouble setting up masked domains or mail alias’s similar to your own setup, with limitations on a test server. Please allow me some additional time for further testing. I’ll get back to you at some stage tomorrow with additional insights once we have a similar setup.

    Thread Starter Zeliha Canderengul

    (@zelihacanderengul)

    @jamesosborne The .htaccess is:

    `# BEGIN WpFastestCache
    # Modified Time: 30-06-21 0:30:05
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} =on
    RewriteCond %{HTTP_HOST} ^ozmyo.com
    # Start WPFC Exclude
    # End WPFC Exclude
    # Start_WPFC_Exclude_Admin_Cookie
    RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=Zeliha\sCanderengul
    # End_WPFC_Exclude_Admin_Cookie
    RewriteCond %{HTTP_HOST} ^ozmyo.com
    RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WP_FASTEST_CACHE_CSS_VALIDATOR|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot)
    RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot)
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{REQUEST_URI} !(\/){2}$
    RewriteCond %{REQUEST_URI} \/$
    RewriteCond %{QUERY_STRING} !.+
    RewriteCond %{HTTP:Cookie} !wordpress_logged_in
    RewriteCond %{HTTP:Cookie} !comment_author_
    RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil
    RewriteCond %{HTTP:Profile} !^[a-z0-9\”]+ [NC]
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or]
    RewriteCond /home2/b452006/public_html/ozmyo/wp-content/cache/all/$1/index.html -f
    RewriteRule ^(.*) “/wp-content/cache/all/$1/index.html” [L]
    </IfModule>
    <FilesMatch “index\.(html|htm)$”>
    AddDefaultCharset UTF-8
    <ifModule mod_headers.c>
    FileETag None
    Header unset ETag
    Header set Cache-Control “max-age=0, no-cache, no-store, must-revalidate”
    Header set Pragma “no-cache”
    Header set Expires “Mon, 29 Oct 1923 20:30:00 GMT”
    </ifModule>
    </FilesMatch>
    # END WpFastestCache

    # BEGIN rlrssslReallySimpleSSL rsssl_version[4.0.15]
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    </IfModule>
    # END rlrssslReallySimpleSSL

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    # php — BEGIN cPanel-generated handler, do not edit
    # Set the “ea-php74” package as the default “PHP” programming language.
    <IfModule mime_module>
    AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
    </IfModule>
    # php — END cPanel-generated handler, do not edit`

    Just to keep you updated we’ve managed to setup a similar setup to your own and we’re currently debugging. The issue seems to be the AMP plugin is generating the amphref before Polylang is also apply the various alternate URLs.

    We’ll keep you posted here after some further testing, it may be possible to create a mini plugin to account for such configurations.

    Thanks again for your patience on this. Can you add the below to a custom plugin or your theme functions.php – preferabley a child theme and check for the same issue once more?

    function pll_amp_home_url( $home_url ) {
    	if ( function_exists( 'pll_home_url' ) && false !== strpos( $home_url, 'amp' ) ) {
    		$home_url = pll_home_url();
    	}
    	return $home_url;
    }
    add_filter( 'home_url', 'pll_amp_home_url', 20, 1 );

    Hi there @zelihacanderengul Just checking in here –?were you able to get this code added to your functions.php theme, and did it fix your issue? Are you still having trouble? Just let us know and we’d be happy to help.

    @zelihacanderengul As we haven’t received a response, I’ll mark this as resolved. Feel free to open a new support topic if you continue to encounter issues, or reopen this topic and we’d be happy to assist. Thank you!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘It does not automatically redirect AMP pages to Mobile visitors for the subdomai’ is closed to new replies.