Can I edit the really simple ssl htacess line to make sure the www never shows up?

Avatar
  • updated
  • Answered

Really simple changed my htaccess file and amended/deleted the lines that forced the www.mysite.com to always redirect to mysite.com.  So, now google and bing both read both the www and the non-www page.   This is causing two issued... 1) a duplicate page which can hurt rankings; and 2) the www page never shows up as mobile friendly.  Is there a way to edit the htaccess command that Really Simple puts in to add the remove www?  ie here is your htaccess commands:

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

But, I need this to remove the www consistently:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ http://<em>mysite.com</em>/$1 [R=301,L]

When I add those lines either above or below the ReallySimple lines, it doesn't correct the problem.  But, if I turn Really Simple off and add that rewrite rule, it works.  So, how can I keep Really Simple active, while still making sure the command for the force-no-www works?

Thank you so much!!!!

Avatar
IMH Support Agent 2
  • Answered

Hello Andrea,

Thanks for the question about the WWW/non-WWW/https issue caused with the ReallySimple plugin.  Honestly, the WWW and non-WWW version of a website is automatically recognized by the server even without the 301 re-directs.  The 301 re-direct indicates to search engine the preferred form of your URL.  You can have multiple conditions in your .htaccess re-write statement to cover BOTH .htaccess and the use of HTTPS.  We don't currently have a good tutorial on our support center for writing this kind of code, but you can check out this post for a good explanation of how this can be done. 

Additionally, you should read this post from the Really Simple website in regards to both non-www and HTTPS conditions.  It appears that other users of the plugin have encountered this issue as well.

If you have any further questions or comments, please let us know.

Kindest regards,
Arnel C.