Title: Double redirect from https://www
Last modified: June 15, 2025

---

# Double redirect from https://www

 *  Resolved [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/)
 * Hi, I use 301 redirect option (through .htaccess) in Really Simple SSL plugin.
   However, if I type [https://www.litfan.ru/](https://www.litfan.ru/) , then appears
   a double redirect (first one from .htacess , and second one from WordPress php).
   Is there any way how to redirect from www to non www URL on .htaccess level only?
   Do you have this option in your plugin’s settings? Atm I found this code on Internet
   for .htaccess:
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{HTTP_HOST} ^www\.litfan\.ru [NC]
       RewriteRule ^(.*)$ https://litfan.ru/$1 [L,R=301]
       </IfModule>
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdouble-redirect-from-https-www%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * (@jarnovos)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18513635)
 * Hi [@giorgos93](https://wordpress.org/support/users/giorgos93/),
 * The **301 .htaccess redirect** in this plugin would only redirect the user from`
   http://` to `https://`, but it does **not** add or remove the “www.” part from
   the URL.
 * As far as I can see, this already seems to be working as expected when visiting
   your site, as the redirect chain is: `http://www.litfan.ru/ -> https://www.litfan.
   ru/ -> https://litfan.ru/`, which is considered a best practice (first we redirect
   from `http://` to `https://` and remove `www.` subdomain afterwards).
 * This redirect should be the one that originates from your `.htaccess` file as
   opposed to the WordPress redirect, as this exact same redirect still takes place
   when I reach your Bot Prevention/CAPTCHA page (outside of WordPress), and as 
   WordPress isn’t loaded at that point, it can’t use the PHP redirect either.
 * Kind regards, Jarno
 *  Thread Starter [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18514048)
 * Hi, [@jarnovos](https://wordpress.org/support/users/jarnovos/)
 * Yes, it works, because I’ve added the code yesterday, that I mentioned above.
   That’s great, that it works in such order, even though I added the code **before**
   your plugin’s code in .htacess. Why did the website make a right order then?
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{HTTP_HOST} ^www\.litfan\.ru [NC]
       RewriteRule ^(.*)$ https://litfan.ru/$1 [L,R=301]
       </IfModule>
   
       #Begin Really Simple Security
       <IfModule mod_rewrite.c>
       RewriteEngine on
       RewriteCond %{HTTP:X-Forwarded-Proto} !https
       RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache)
       RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
       </IfModule>
   
       #End Really Simple Security
       ```
   
 * And also: the removal of www. is working on .htaccess only? WP doesn’t trigger
   it again on php-level? It would be bad, if the same redirect is triggering twice.
 *  Plugin Support [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * (@jarnovos)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18514164)
 * Hi [@giorgos93](https://wordpress.org/support/users/giorgos93/),
 * I hope I understand your question correctly; the rewrite rules in are processed
   from top to bottom, but as your redirect uses the `[L]` flag, it stops any further
   rewrite processing if the condition is met.
 * That’s why everything still works as expected, your rule handles the www. redirect,
   and our rules below that would only take effect if the request doesn’t match 
   yours.
 * And indeed, WordPress itself wouldn’t trigger the same redirect again in PHP.
   If the redirect is already completed in the .htaccess, WordPress would receive
   the request directly at the correct (non-www) URL.
 * Kind regards, Jarno
 *  Thread Starter [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18514765)
 * Hi, [@jarnovos](https://wordpress.org/support/users/jarnovos/)
 * Yes, you did understand me correctly. And yes, the rewrite rules are processed
   from top to bottom in .htaccess. That is why I was surprised, that they work 
   in a right order, because www removal starts **before** https redirect in .htaccess.
   But you wrote, that the redirect chain is: [http://www.litfan.ru/](http://www.litfan.ru/)-
   > [https://www.litfan.ru/](https://www.litfan.ru/) -> [https://litfan.ru/](https://litfan.ru/).
   But it should be vice versa, because of my code’s order. Shouldn’t it?
 *  Plugin Support [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * (@jarnovos)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18515393)
 * Hi [@giorgos93](https://wordpress.org/support/users/giorgos93/),
 * Yes, I think you are correct. It was bit more challenging to “see” the actual
   redirects here as I can’t do a check via cURL (as I get the verification screen
   instead).
 * But indeed on closer inspection with a request to `http://www.litfan.ru`, it 
   looks like your www removal rule matches immediately and therefore issues a redirect
   to `https://` in one step.
 * Kind regards, Jarno
 *  Thread Starter [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18515400)
 * [@jarnovos](https://wordpress.org/support/users/jarnovos/) is it a normal behaviour?
   It should be like that in my case, or I need to change something?
 *  Plugin Support [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * (@jarnovos)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18515411)
 * Hi [@giorgos93](https://wordpress.org/support/users/giorgos93/),
 * Yes, your redirect is getting triggered exactly as expected. This is perfectly
   fine to handle both the `www.` removal and enforcing HTTPS.
 * Kind regards, Jarno
 *  Thread Starter [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18515428)
 * Thanks [@jarnovos](https://wordpress.org/support/users/jarnovos/)! Is it possible
   to add such option in your plugin in future, so there is no need to change the
   code manually? It would be useful for websites, that want to redirect from www
   on .htaccess level.
 *  Thread Starter [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18515945)
 * [@jarnovos](https://wordpress.org/support/users/jarnovos/) and one more question:
   I use WP Fastest Cache plugin on my website, and Really Simple Security has this
   piece of code in my .htaccess file:
 * RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache)
 * Is it better to add this piece of code in my version of code as well? So it’ll
   look like this:
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{HTTP_HOST} ^www\.litfan\.ru [NC]
       RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache)
       RewriteRule ^(.*)$ https://litfan.ru/$1 [L,R=301]
       </IfModule>
       ```
   
 *  Plugin Support [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * (@jarnovos)
 * [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18515981)
 * Hi [@giorgos93](https://wordpress.org/support/users/giorgos93/),
 * While I do understand the request, we currently focus strictly on the protocol(
   e.g., http:// -> [https://](https://wordpress.org/support/topic/double-redirect-from-https-www/?output_format=md)),
   without enforcing a specific domain format like `www.` or `non-www`, and I suspect
   that this approach is unlikely to change in the near future.
 * As for your other question, the condition is used in the HTTPS redirect to avoid
   unnecessary redirects on cached files (`/wp-content/cache/`). Your redirect is
   unlikely to interfere with those, but it also won’t hurt to add it anyway.
 * Kind regards, Jarno

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

The topic ‘Double redirect from https://www’ is closed to new replies.

 * ![](https://ps.w.org/really-simple-ssl/assets/icon-256x256.png?rev=2839720)
 * [Really Simple Security - Simple and Performant Security (formerly Really Simple SSL)](https://wordpress.org/plugins/really-simple-ssl/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/really-simple-ssl/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/really-simple-ssl/)
 * [Active Topics](https://wordpress.org/support/plugin/really-simple-ssl/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/really-simple-ssl/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/really-simple-ssl/reviews/)

 * 10 replies
 * 2 participants
 * Last reply from: [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * Last activity: [11 months, 3 weeks ago](https://wordpress.org/support/topic/double-redirect-from-https-www/#post-18515981)
 * Status: resolved