• I installed a WordPress app on an OpenShift machine and added aliases (on OpenShift) and CNAMES to it (on CloudFlare).

    I started getting a redirect loop error only when I was going to the website without www. And only on root. Going to wp-admin, for example, with or without the www. works well.

    Then I commented my .htaccess and put a message on index.php. The message is shown, both with and without www. wp-admin still works.

    I got the default .htaccess

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

    Do you know what could be wrong with my settings?

Viewing 2 replies - 1 through 2 (of 2 total)
  • try to add this lines after RewriteEnginge On

    RewriteCond %{HTTP_HOST} !www.yourdomainname$ [NC]
    RewriteRule ^(.*)$ http://www.yourdomainname/$1 [L,R=301]

    Regards

    Thread Starter porta8080

    (@porta8080)

    Hey David, is this meant to make every request without ‘www.’ appends ‘www.’ to the beginning of the URL?

    The problem has a new behavior:
    When I change the Website address (URL) in the settings page to http://mywebsite.com, the problem changes to the address WITH www. So the problem has something to do with this variable. It won’t give me an error depending on what is written there

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

The topic ‘WordPress .htaccess causing redirect loop on root only without 'www.'’ is closed to new replies.