• Hello,

    Please, if you can enlighten me, how would it be possible to edit my .htaccess file to force the addition of “www” in my URL when it isn’t present inside already… without killing the permalinks that are missing the www ? ?
    The problem: it can’t be a simple redirection to https://www.mywebsite.com, the deep links missing the www would be redirected to the home page.

    The best code I found so far doesn’t do the work correctly, it kills deep links missing “www”.
    For instance, https://mywebsite.com is successfully changed into https://www.mywebsite.com
    BUT a deep link like https://mywebsite.com/2009/06/example-plage is changed into https://www.mywebsite.com/index.php

    If you’re curious, at the present time (affected by wp-supercache and with 3 additional lines to unsuccessfully force the “www”, here is a copy at my htaccess :
    https://lartetlescan.free.fr/myhtaccess.txt

    I tried another variation with exactly the same result :
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteCond %{HTTP_HOST} ^([^.]+\.[a-z]{2,6})$ [NC]
    RewriteRule ^(.*)$ https://www.%1/$1 [R=301,L]

    Thanks a LOT if you can help, I’ll be grateful ??
    Sabin

  • The topic ‘Force ‘www’ with special requirements…’ is closed to new replies.