# Redirect http to https

**URL:** <https://forums.realmacsoftware.com/t/redirect-http-to-https/23444>\
**Category:** RapidWeaver Classic\
**Created:** [November 16, 2018, 6:19pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444 "2018-11-16T18:19:25Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Printdevil](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/printdevil/32/29847_2.png) [@Printdevil](https://forums.realmacsoftware.com/u/Printdevil)\
**Post date:** [November 16, 2018, 6:19pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/1 "2018-11-16T18:19:25Z")

</div>

I realise what I am about to ask has been asked many times on this forum before but I am experiencing similar difficulties in trying to redirect my http site to https.

The site is hosted with [123-Reg.co.uk](http://123-Reg.co.uk) and the domain is…  
[http://www.hiabhireuk.com](http://www.hiabhireuk.com)  
and here are my FTP details for the upload…

 ![HIAB%20Hire%20Website%203%202018-11-16%2017-58-05](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/2X/a/a07e1593c8924dbcdbf6bd0308a1b05f20d0ee55.jpeg)

I have clicked on the edit .htaccess File and inserted the following code…

 ![Monosnap%202018-11-16%2018-11-19](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/2X/a/a62351ca80c908674b5620b196c9641704bd2931.jpeg)  
which broke the site

I then tried…

 ![Monosnap%202018-11-16%2018-01-05](https://europe1.discourse-cdn.com/flex005/uploads/realmacsoftware1/original/2X/a/a8b006876122792f7babfa9856aaf186850c5977.jpeg)  
which also didn’t work.

I found this bit of code on the 123-Reg site here…

> **[SSL Certificates - How to install and manage certificates](https://www.123-reg.co.uk/support/ssl-certificates/)**
>
> Find out what an SSL certificate is and how you can install, or back-up certificates from our support articles and videos.

_&Order deny,allow_  
_Deny from all_  
_Allow from env=SSL_

but that also seems to break it.

So I have removed the code altogether so the site can at least be seen on http and https.

Can anyone help advise on how I can fix this, I have contacted their support line and they told me I have to figure out how to configure RapidWeaver to do this on my own.

---

<div class="post-metadata">

**Author:** ![jabostick](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/jabostick/32/1760_2.png) [@jabostick](https://forums.realmacsoftware.com/u/jabostick)\
**Post date:** [November 16, 2018, 6:25pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/2 "2018-11-16T18:25:41Z")

</div>

That’s a pretty sad customer service response. Hosts might vary but this is one that worked for me in the past:  
`RewriteEngine On RewriteCond %{HTTP_HOST} ^example\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]`

Also, I dont know how RW works if there is already an htacces file on your server. Might want to double check that…

---

<div class="post-metadata">

**Author:** ![joeworkman](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/joeworkman/32/23780_2.png) [@joeworkman](https://forums.realmacsoftware.com/u/joeworkman)\
**Post date:** [November 16, 2018, 6:27pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/3 "2018-11-16T18:27:24Z")

</div>

Try this one…

```auto
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]

```

Also listen to

> **[Weaver Radio | #10: Jump onto the HTTPS bandwagon](https://www.weaverradio.com/episodes/10-jump-onto-the-https-bandwagon)**
>
> This show is all about HTTPS. We cover... How do you acquire SSL certificates? How do you configure your RapidWeaver projects to use HTTPS? Why do we even need to do this?

---

<div class="post-metadata">

**Author:** ![teefers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teefers/32/8173_2.png) [@teefers](https://forums.realmacsoftware.com/u/teefers)\
**Post date:** [November 16, 2018, 6:54pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/4 "2018-11-16T18:54:11Z")

</div>

Here is a rule that doesn’t even require you to add the URL (should work on anysite):

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

```

Here is an htaccess file tester, so you can test the redirect rules **before** you add them to your site:  
[https://htaccess.madewithlove.be](https://htaccess.madewithlove.be)

And if you want to check each page of the site for mixed content (active mixed content will break the site), _before_ you switch:  
[https://www.whynopadlock.com/](https://www.whynopadlock.com/)

---

<div class="post-metadata">

**Author:** ![Sharky](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/sharky/32/12574_2.png) [@Sharky](https://forums.realmacsoftware.com/u/Sharky)\
**Post date:** [November 17, 2018, 9:33pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/5 "2018-11-17T21:33:35Z")

</div>

Here is the rule that I am using:

```
RewriteEngine On

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

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
```

---

<div class="post-metadata">

**Author:** ![Printdevil](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/printdevil/32/29847_2.png) [@Printdevil](https://forums.realmacsoftware.com/u/Printdevil)\
**Post date:** [November 21, 2018, 2:54am UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/6 "2018-11-21T02:54:18Z")

</div>

Thank you all for your responses, I have tried all of these and none of them work so I have emailed [123-Reg.co.uk](http://123-Reg.co.uk) support to see if they can give me an answer. I shall report back.

---

<div class="post-metadata">

**Author:** ![Printdevil](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/printdevil/32/29847_2.png) [@Printdevil](https://forums.realmacsoftware.com/u/Printdevil)\
**Post date:** [November 21, 2018, 8:49am UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/7 "2018-11-21T08:49:20Z")

</div>

OK 123-Reg have come back with this .htaccess code…  
RewriteEngine On  
RewriteCond %{ENV:HTTPS} !=on  
RewriteRule ^.\*$ https://%{SERVER\_NAME}%{REQUEST\_URI} [R,L]

But it still doesn’t appear to have worked so I am now at a complete loss. So frustrating!  
The hosting company support response said if this doesn’t work then I need to seek help from a developer as coding support falls outside of their scope!

The non secure website is [http://www.hiabhireuk.com/](http://www.hiabhireuk.com/)  
and the secure is [https://www.hiabhireuk.com/](https://www.hiabhireuk.com/)

How can I get the non secure to automatically redivert to the secure?

---

<div class="post-metadata">

**Author:** ![DaveFox](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/davefox/32/129_2.png) [@DaveFox](https://forums.realmacsoftware.com/u/DaveFox)\
**Post date:** [November 21, 2018, 9:37am UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/8 "2018-11-21T09:37:28Z")

</div>

HTTP link redirects to HTTPS for me on Chrome / Firefox / Safari

---

<div class="post-metadata">

**Author:** ![Printdevil](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/printdevil/32/29847_2.png) [@Printdevil](https://forums.realmacsoftware.com/u/Printdevil)\
**Post date:** [November 21, 2018, 10:10am UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/9 "2018-11-21T10:10:12Z")

</div>

Aha! It looks as if my cache might have been the issue, it appears to be all working now. What a relief.

Thanks to everyone who helped me on this issue before I pulled all my hair out. Keep up the great work guys, I love RapidWeaver and this forum!

---

<div class="post-metadata">

**Author:** ![teefers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teefers/32/8173_2.png) [@teefers](https://forums.realmacsoftware.com/u/teefers)\
**Post date:** [November 21, 2018, 12:14pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/10 "2018-11-21T12:14:39Z")

</div>

The code given to you is like the code I gave you in my post **with one difference**. It has no return code.  
That means it’s going to more than likely use the default 302 temporary redirect. I’m on my iPad, so I can’t check it right now.

- Status 301 means that the resource (page) is moved permanently to a new location. The client/browser should not attempt to request the original location but use the new location from now on.
- Status 302 means that the resource is temporarily located somewhere else, and the client/browser should continue requesting the original url.

Search engines will penalize you for continuous use of the 302. Some of the bad folks out there try to play a URL “shell game” using 302’s.

Status 301 being a _permanent_ move prevents this shell game. Because they are **permanent** you need to be careful, there’s kinda “no way back”. They have no expiry associated with them, so they technically can be cached forever.

1. My suggestion is to **use the test tool** above first.
2. Test every page (or a good sample) with each combination (HTTP,HTTPS, WWW, non-WWW, sub domains, etc). It’s good to put together a “script” for this to reuse.
3. “Go Live” first with a 302 (same script above change the 301 to 302)
4. Retest everything (step 2)
5. Change the 302 back to 301
6. Retest everything again (step 2)

This is a _major_ change to your site, it effects every page and every resource.

---

<div class="post-metadata">

**Author:** ![Printdevil](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/printdevil/32/29847_2.png) [@Printdevil](https://forums.realmacsoftware.com/u/Printdevil)\
**Post date:** [November 21, 2018, 2:48pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/11 "2018-11-21T14:48:09Z")

</div>

OK new update…

It turns out that it wasn’t my cache at all, the reason why it is now working is because the host support rep noticed the .htaccess file had not some incorrect line endings. He fixed it on the server and that is why it is now functioning properly.

---

<div class="post-metadata">

**Author:** ![teefers](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/teefers/32/8173_2.png) [@teefers](https://forums.realmacsoftware.com/u/teefers)\
**Post date:** [November 21, 2018, 3:03pm UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/12 "2018-11-21T15:03:12Z")

</div>

Your website when entered without the https ( `http://www.hiabhireuk.com` ) is redirecting fine to https **but is returning a 302 status - temporarily move**. You need to fix that.  
[http://www.redirect-checker.org/index.php](http://www.redirect-checker.org/index.php)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/system/32/25301_2.png) [@system](https://forums.realmacsoftware.com/u/system)\
**Post date:** [December 22, 2018, 1:03am UTC](https://forums.realmacsoftware.com/t/redirect-http-to-https/23444/13 "2018-12-22T01:03:17Z")

</div>

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