Canonical Tag

#1117123
  • Hi,

    I had the message about the Canonical Tag in RankMath.

    I followed the guide and enter the information from this website:

    https://www.siteground.com/kb/how_to_redirect_www_urls_to_nonwww/

    Into my .htaccess file:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.ilex-luxury.nl [NC]
    RewriteRule ^(.*)$ http://ilex-luxury.nl/$1 [L,R=301]
    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

    The message about the canonical tag was still displayed in rankmatch and the issue didn’t seem to be solved.

    After i removed:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.ilex-luxury.nl [NC]
    RewriteRule ^(.*)$ http://ilex-luxury.nl/$1 [L,R=301]

    from the .htaccess file and i created a htaccess (without the .) file with the same information:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.ilex-luxury.nl [NC]
    RewriteRule ^(.*)$ http://ilex-luxury.nl/$1 [L,R=301]
    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>

    AND kept the .htaccess file with this code:

    <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>

    The message about the canonical tag disappeared. How is that possible? As normally it shouldn’t run a htaccess file without the . in front of it.

    And why does the code not work when i put it in the .htaccess file?

    My setup: Synology NAS 423+ and running the website in a container.\

    Thanks already for the support

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

    We apologize for the issue you are facing with the canonical tag and the .htaccess file configuration. It seems that the changes you made to your .htaccess file did not work as expected, but removing the problematic code and creating a new htaccess file (without the dot) resolved the issue.

    Typically, the web server looks for a file named .htaccess to apply the rules specified within it. If you created a file without the dot, it might not be recognized by the server as a configuration file, which is unusual. However, if your server is somehow processing that file, it could be due to specific configurations on your Synology NAS or how it handles rewrite rules.

    Here are a few things to consider:

    1. Server Configuration: Check if your Synology NAS has any custom configurations that might allow it to read files without the dot as configuration files.
    2. File Permissions: Ensure that the .htaccess file has the correct permissions set so that the server can read it properly.
    3. Syntax Errors: Double-check for any syntax errors in your .htaccess file that might prevent it from executing correctly.
    4. Caching: Sometimes, caching mechanisms can cause changes not to reflect immediately. Clearing your cache might help.

    If you continue to experience issues or have further questions about your setup, please reply to this ticket, and a human agent from our support team will assist you further. Thank you for raising this concern!

    Sources:
    Why Are Posts Redirecting to www or Non-www Incorrectly?
    How to Redirect WWW Version to Non-WWW Version of Your Website » Rank Math

    This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.

    I’m also running Cloudflare. Maybe that has something todo with it?

    Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    We checked your website and the www versions of your domain is throwing a 404 at the moment:

    https://www.ilex-luxury.nl/

    Rank Math support

    Please try using this .htaccess rule instead:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.ilex-luxury.nl [NC]
    RewriteRule ^(.*)$ https://ilex-luxury.nl/$1 [L,R=301]

    If the issue persists, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.

    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this ticket.