• At first I didn’t use permalinks at my site. Also, I used and I’m still using a non-www to www redirection in my .htaccess:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

    The problem came when I started using permalinks. The non-www redirection stopped working and a page titled “301 Moved Permanently” showed with this error:

    Moved Permanently
    The document has moved here.

    Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

    So it seems that the code for the permalinks added to the .htaccess is overriding the non-www redirection, or there is some kind of trouble between the codes. The code for the permalink structure is this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Thanks in advance.

  • The topic ‘Redirect non-www to www and permalinks trouble’ is closed to new replies.