I have a problem redirecting http to https

hi its me again sorry I always get stuck with something

I turned on cloudflare in my cPanel (I wish I had seen that before I wasted a week trying to install a ssl certificate lol) anyways my site works if I type https://www.lovebug.ml into the address bar

the problem im having is when trying to redirect my site both http://lovebug.ml and http://www.lovebug.ml to https://www.lovebug.ml

I added these lines to the .htaccess file in my site root
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.lovebug.ml/$1 [L,R=301]

but my browser says
The page isn’t redirecting properly
An error occurred during a connection to www.lovebug.ml.
This problem can sometimes be caused by disabling or refusing to accept cookies.

I’ve commented these lines out for now, any ideas what I messed up this time ?


While protecting your site via Cloudflare, it is not recommended to perform redirects at your origin web server:

  • Page Rule redirects are processed at the Cloudflare edge resulting in quicker response and reduced requests to your server.
  • Origin web server redirects can cause redirect loop errors

And if you really want everything to be on www

I don’t like www so here’s some quote :smile:

Here are a few citations from ancient discussions:

I think most people are used to having www. in front of a url. If they even notice it, I think it will confuse them not having that.

I’ve seen some sites that redirect to m.example.com if you’re accessing them from a phone. Do you think people are getting confused by that?

You’re describing a world where everybody expected a website to end in .com, and if not that, then maybe a handful of others. That world is changing; what will people’s expectations be in the future?

The thing is, www prefix was never a requirement. It came about as a convention to very specifically indicate that www.example.com = web server, and ftp.example.com = ftp server, etc.
There’s no real reason to do it, other than convention from the early days. The CNAME restriction is really the only technical gotcha, and this is slowly becoming a non-issue with DNS services like Route 53 that now allow CNAME on roots.

I just find it odd that www is still considered a convention by some. If you’re redirecting the root to www anyway, there is no reason to use www. You may as well use hi.example.com
as your primary domain and just redirect example.com to hi.example.com. www has no intrinsic meaning, it’s just a regular subdomain with DNS records like any other subdomain.


thanks for the reply, personally I didnt want the www either but when I tried it without it was saying my site was insecure ??? but i’ve just tried it again without www and its secure now so I guess it just took time (i only turned it on in the cPanel today)

I wasnt really worried about the protection although it’ll come in handy , I just used the cloudflare because after spending a week trying to get an ssl certificate working and pulling out my hair it was the easy option and I dont want to go bald :slight_smile:

but the http:// version of my site isnt redirecting to https:// any ideas ?

btw I havent signed up with cloudflare I just used infinityfree’s cloudflair button in the cPanel and enabled it

Does it just take time to automatically redirect http to https ? or will I have to sign up with cloudflare and set it up ?




it is better for you to register on Cloudflare because there are many more options and services offered

the first link I gave you (https://blog.cloudflare.com/how-to-make-your-site-https-only/)

and then do purge all in CF just in case


sorry I think im half asleep some how I read that link you posted then forgot about it in my reply omg

I’ve been avoiding signing up with cloudflare because I didnt want to go through all that crazy stuff with ssl cetificates that blew my mind the last time I tried but I’ll take a look thanks

------ edit -------------

I really am half asleep, just tried to signup with cloudflare and it says my email is already registered, thats it im off to bed

------- edit 2 --------------

ah ok I didnt sign up with cloudflare, infinityfree did it for me when i clicked the cloudflare button in cPanel. that was unexpected !

------- edit 3 ---------------

well that was painless, i thought i would have to start from scratch but all I had to do is register a password and verify my email address and thats it I have the cloudflare control panel

wow thanks again to infinityfree, amazing stufff :slight_smile:

and a special thank you to OxyDac for all the help



now you can go to sleep peacefully !

good night :slight_smile:


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.