Viewing 6 replies - 1 through 6 (of 6 total)
  • Might try this instead:

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^numbers-stations\.com$ [NC]
    RewriteRule ^(.*)$ https://www\.numbers-stations\.com/$1 [L,R=301]
    
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    </IfModule>
    
    # END WordPress

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

    @shazepe,

    You can also do this at the DNS level using a service like CloudFlare for an additional layer of 301 redirect (i.e. Page Rules in CloudFlare).

    Then use a plugin like Better Search Replace to replace all the old versions of your URLs in the database, along with one of the .htaccess examples provided to you above.

    Thread Starter shazepe

    (@shazepe)

    Hi, none of these options worked :/ and I don’t plan on using cloudflare forever. How does everyone else get this to work, everything on google has failed or what I search for is 5+ years old.

    Curious, in your General Settings, what do you have for your WordPress Address (URL) and Site Address (URL)? Those need to have the “www.” in them as well.

    Looking at the source code of your site, I see a mix of URLs with and without the “www.”. So it’s not consistent there as well.

    Thread Starter shazepe

    (@shazepe)

    ^ Thanks a lot dude lol, I didn’t see those settings before. The redirect works perfect now thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Redirect from non www to www’ is closed to new replies.