Czy chcesz przenieść WordPress z HTTP na HTTPS i zainstalować certyfikat SSL na twojej witrynie internetowej?
Otrzymaliśmy wiele zapytań na ten temat, ponieważ Google ogłosiło w lipcu 2018 r., że przeglądarka Chrome będzie oznaczać wszystkie witryny internetowe bez SSL jako niezabezpieczone.
W tym artykule pokażemy, jak prawidłowo przenieść WordPress z HTTP na HTTPS poprzez dodanie certyfikatu SSL.
Nie martw się, jeśli nie masz pojęcia, czym jest SSL lub HTTPS. Wyjaśnimy to również.
Co to jest HTTPS?
HTTPS lub Secure HTTP to metoda szyfrowania, która zabezpiecza połączenie między przeglądarką użytkownika a twoim serwerem. Utrudnia to hakerom podsłuchiwanie połączenia.
Każdego dnia udostępniamy nasze dane osobowe różnym witrynom internetowym, czy to dokonując zakupu, czy po prostu logując się.
Aby zabezpieczyć transfer danych, należy utworzyć bezpieczne połączenie.
Wtedy właśnie pojawiają się SSL i HTTPS.
Każda witryna otrzymuje unikatowy certyfikat SSL w celu identyfikacji. Jeśli serwer udaje, że korzysta z protokołu HTTPS, a jego certyfikat nie jest zgodny, większość nowoczesnych przeglądarek ostrzega użytkownika przed połączeniem się z witryną internetową.
Teraz pewnie zastanawiasz się, dlaczego muszę przenieść moją witrynę WordPress z HTTP na HTTPS, zwłaszcza jeśli jest to prosty blog lub witryna internetowa małej firmy, która nie pobiera żadnych płatności.
Dlaczego potrzebujesz HTTPS i SSL?
W 2018 roku Google ogłosiło plan poprawy ogólnego zabezpieczenia sieci poprzez zachęcanie właścicieli witryn internetowych do przejścia z protokołu HTTP na HTTPS. W ramach tego planu ich popularna przeglądarka internetowa Chrome oznaczałaby wszystkie witryny internetowe bez certyfikatu SSL jako „Niezabezpieczone”.
Google stwierdziło również, że witryny internetowe z SSL również odniosą korzyści SEO i uzyskają wyższe rankingi wyszukiwania niż witryny niezabezpieczone. Od tego czasu wiele witryn internetowych przeszło z protokołu HTTP na HTTPS.
Po ogłoszeniu, Google rozpoczęło wdrażanie ostrzeżenia „Not Secure” w Chrome. Na przykład, jeśli ktoś przejdzie na witrynę internetową HTTP przy użyciu okna incognito, zostanie ona oznaczona jako Niezabezpieczona. Jeśli ktoś przejdzie na stronę HTTP w zwykłym trybie i spróbuje wypełnić formularz kontaktowy lub inny formularz, witryna internetowa zostanie oznaczona jako niezabezpieczona.
Kiedy twoi czytelnicy i klienci widzą to powiadomienie, daje im to złe wrażenie o twojej firmie.
Dlatego wszystkie witryny internetowe muszą natychmiast przejść z HTTP na HTTPS i zainstalować SSL.
Nie wspominając już o tym, że jeśli chcesz akceptować płatności online na swojej witrynie internetowej e-handel, potrzebujesz SSL.
Większość firm płatniczych, takich jak Stripe, PayPal Pro, Authorize.Net itp., będzie wymagać bezpiecznego połączenia przed zaakceptowaniem płatności.
Używamy SSL dla naszych witryn internetowych, w tym WPBeginner, OptinMonster, WPForms i MonsterInsights.
Wymagania dotyczące korzystania z HTTPS/SSL na witrynie WordPress
Wymagania dotyczące korzystania z SSL w WordPress nie są zbyt wysokie. Wszystko, co musisz zrobić, to kupić certyfikat SSL, a być może masz go już za darmo.
Najlepsze firmy hostingowe WordPress oferują darmowe certyfikaty SSL dla wszystkich swoich użytkowników:
Więcej szczegółów można znaleźć w naszym przewodniku na temat tego, jak uzyskać bezpłatny certyfikat SSL dla twojej witryny internetowej WordPress.
Jeśli twoja firma hostingowa nie oferuje bezpłatnego certyfikatu SSL, musisz go zakupić.
Zalecamy korzystanie z Domain.com, ponieważ oferują najlepszą ofertę SSL zarówno dla zwykłych, jak i wieloznacznych certyfikatów SSL.
Kupując u nich certyfikat SSL, otrzymujesz również pieczęć TrustLogo dla Twojej witryny internetowej, a każdy certyfikat SSL jest objęty minimalną gwarancją zabezpieczenia w wysokości 10 000 USD.
Po zakupie certyfikatu SSL należy poprosić dostawcę hostingu o jego zainstalowanie.
Konfiguracja WordPressa do korzystania z SSL i HTTPS
Po włączeniu certyfikatu SSL dla twojej domeny, będziesz musiał skonfigurować WordPressa tak, aby używał protokołów SSL i HTTP na twojej witrynie internetowej.
Pokażemy ci dwie metody, aby to zrobić i możesz wybrać tę, która najlepiej odpowiada twoim potrzebom.
Film instruktażowy
Jeśli wolisz pisemne instrukcje, czytaj dalej
Metoda 1: Konfiguracja SSL/HTTPS w WordPress przy użyciu wtyczki
Ta metoda jest łatwiejsza i zalecana dla początkujących.
Najpierw należy zainstalować i włączyć wtyczkę Really Simple SSL. Aby uzyskać więcej informacji, zobacz nasz przewodnik krok po kroku, jak zainstalować wtyczkę WordPress.
Po włączaniu należy przejść na stronę Ustawienia ” SSL. Wtyczka automatycznie wykryje twój certyfikat SSL i skonfiguruje witrynę WordPress do korzystania z protokołu HTTPS.
Wtyczka zajmie się wszystkim, w tym błędami związanymi z mieszaną treścią. Oto, co wtyczka robi za kulisami:
- Sprawdź certyfikat SSL
- Ustawienie WordPressa tak, by używał https w adresach URL
- Konfiguracjaprzekierowań z HTTP na HTTPS
- Poszukaj adresów URL w twojej treści, które wciąż są wczytywane z niezabezpieczonych źródeł HTTP i spróbuj je poprawić.
Uwaga: Wtyczka próbuje poprawiać błędy mieszanej treści przy użyciu techniki buforowania wyjściowego. Może to mieć negatywny wpływ na wydajność, ponieważ zastępuje treść na witrynie podczas wczytywania strony. Wpływ ten jest widoczny tylko przy pierwszym wczytywaniu strony i powinien być minimalny, jeśli używasz pamięci podręcznej wtyczki.
Chociaż wtyczka mówi, że możesz zachować SSL i bezpiecznie wyłączać wtyczkę, nie jest to w 100% prawdą. Będziesz musiał pozostawić wtyczkę aktywną przez cały czas, ponieważ wyłączanie wtyczki spowoduje powrót błędów mieszanej treści. Więcej szczegółów można znaleźć w naszej recenzji Really Simple SSL.
Metoda 2: Ręczna konfiguracja SSL/HTTPS w WordPress
Ta metoda wymaga ręcznego rozwiązywania problemów i edytowania plików WordPress. Jest to jednak trwałe i bardziej zoptymalizowane pod kątem wydajności rozwiązanie, z którego korzystamy na WPBeginner.
Jeśli uważasz, że ta metoda jest trudna, możesz zatrudnić programistę WordPress lub skorzystać z pierwszej metody.
W ramach tej metody może być konieczna edycja motywu WordPress i plików kodu. Jeśli nie robiłeś tego wcześniej, zapoznaj się z naszym przewodnikiem na temat kopiowania i wklejania fragmentów kodu w WordPress.
Najpierw należy przejść na stronę Ustawienia ” Ogólne. W tym miejscu należy zaktualizować twoje pola adresu URL WordPress i witryny, zastępując http na https.
Nie zapomnij kliknąć przycisku „Zapisz zmiany”, aby zapisać twoje ustawienia.
Po zapisaniu ustawień WordPress wyloguje cię i zostaniesz poproszony o ponowne zalogowanie.
Następnie musisz skonfigurować przekierowania WordPress z HTTP na HTTPS, dodając następujący kod do twojego pliku .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
Jeśli korzystasz z serwerów NGINX, będziesz musiał dodać następujący kod, aby przekierować z HTTP na HTTPS w twoim pliku konfiguracyjnym:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
Nie zapomnij zastąpić example.com nazwą twojej domeny.
Wykonując te kroki, unikniesz błędu WordPress HTTPS nie działa, ponieważ WordPress będzie teraz wczytywać całą twoją witrynę internetową za pomocą HTTPS.
Jeśli chcesz wymusić SSL i HTTPS na twoim obszarze administracyjnym WordPress lub stronach logowania, musisz skonfigurować SSL w pliku wp-config.php.
Dodaj następujący kod nad linią „To wszystko, przestań edytować!” w twoim pliku wp-config.php:
define('FORCE_SSL_ADMIN', true);
Ta linia pozwala WordPressowi wymusić SSL / HTTP w obszarze administracyjnym WordPress. Działa również w sieciach witryn WordPress.
Gdy to zrobisz, twoja witryna internetowa jest w pełni skonfigurowana do korzystania z SSL / HTTPS, ale nadal będziesz napotykać błędy mieszanej treści.
Błędy te są powodowane przez źródła (obrazki, skrypty lub arkusze stylów), które nadal są wczytywane przy użyciu niezabezpieczonego protokołu HTTP w adresach URL. W takim przypadku na pasku adresu twojej witryny internetowej nie będzie widoczna ikonka zabezpieczenia w postaci kłódki.
Wiele nowoczesnych przeglądarek automatycznie blokuje niebezpieczne skrypty i zasoby.
Możesz zobaczyć ikonkę kłódki, ale z powiadomieniem o tym w pasku adresu twojej przeglądarki.
Za pomocą narzędzia Inspect można sprawdzić, które treści są serwowane za pośrednictwem niezabezpieczonego protokołu.
Błąd mieszanej treści zostanie wyświetlony jako ostrzeżenie w konsoli ze szczegółowymi informacjami dla każdego elementu mieszanej treści.
Zauważysz, że większość adresów URL to obrazki, ramki iframe i galerie obrazów, podczas gdy niektóre to skrypty i arkusze stylów wczytywane przez twoje wtyczki i motywy WordPress.
Poprawka mieszanych treści w bazie danych WordPressa
Większość nieprawidłowych adresów URL to obrazki, pliki, osadzanie i inne dane przechowywane w twojej bazie danych WordPress. Poprawmy je w pierwszej kolejności.
Musisz znaleźć wszystkie wzmianki o adresie URL twojej starej witryny w bazie danych, które zaczynają się od http i zastąpić je nowym adresem URL witryny, który zaczyna się od https.
Możesz to łatwo zrobić, instalując i włączając wtyczkę Search & Replace Everything. Aby uzyskać więcej informacji, zapoznaj się z naszym przewodnikiem krok po kroku, jak zainstalować wtyczkę WordPress.
Po włączaniu należy przejść na stronę Narzędzia ” WP Wyszukaj i zamień. W polu „Szukaj” należy dodać adres URL Twojej witryny internetowej z http
. Następnie w polu „Zamień” dodaj adres URL Twojej witryny internetowej z https
.
Poniżej zobaczysz wszystkie twoje tabele bazy danych WordPress. Musisz wybrać je wszystkie, aby przeprowadzić dokładną kontrolę.
Następnie kliknij przycisk „Podgląd wyszukiwania i zamiany”, aby zobaczyć wszystkie zmiany wprowadzone przez wtyczkę. Na koniec kliknij przycisk „Zamień wszystko”.
Wtyczka przeszuka teraz twoją bazę danych WordPress pod kątem adresów URL zaczynających się od http i zastąpi je bezpiecznymi adresami URL https. Może to chwilę potrwać, w zależności od rozmiaru twojej bazy danych WordPress.
Poprawka błędów mieszanych treści w motywie WordPress
Innym częstym winowajcą powodującym błędy mieszania treści jest twój motyw WordPress. Każdy przyzwoity motyw WordPress zgodny ze standardami kodowania WordPress nie spowoduje tego problemu.
Po pierwsze, będziesz musiał użyć narzędzia Inspect twojej przeglądarki, aby znaleźć zasoby i miejsce, z którego są wczytywane.
Następnie musisz znaleźć je w twoim motywie WordPress i zastąpić je https. Będzie to trochę trudne dla większości początkujących, ponieważ nie będziesz w stanie zobaczyć, które pliki motywu zawierają te adresy URL.
Poprawka błędów mieszanych treści spowodowanych przez wtyczki
Niektóre zasoby o mieszanej treści będą wczytywane przez wtyczki WordPress. Każda wtyczka WordPress zgodna ze standardami kodowania WordPress nie spowoduje błędów mieszanej treści.
Nie zalecamy edytowania plików wtyczek WordPress. Zamiast tego należy skontaktować się z autorem wtyczki i poinformować go o tym. Jeśli nie odpowiedzą lub nie będą w stanie tego poprawić, powinieneś znaleźć odpowiednią alternatywę.
Uwaga: Jeśli z jakiegoś powodu nadal napotykasz błąd mieszanej treści, zalecamy tymczasowe korzystanie z wtyczki Really Simple SSL, aby nie wpływać na użytkowników, podczas gdy poprawisz problem na witrynie przejściowej lub zatrudnisz programistę.
Prześlij swoją witrynę HTTPS do Google Search Console
Wyszukiwarki takie jak Google uważają https i http za dwie różne witryny internetowe. Aby uniknąć problemów z SEO, musisz poinformować Google, że Twoja witryna internetowa została przeniesiona.
Aby to zrobić, wystarczy przejść do twojego konta Google Search Console i kliknąć przycisk „Dodaj właściwość”.
Spowoduje to wyświetlenie wyskakującego okienka, w którym należy utworzyć nowy adres https twojej witryny internetowej.
Istnieją dwie metody weryfikacji witryny: nazwa domeny lub prefiks adresu URL. Zalecamy metodę prefiksu adresu URL, ponieważ jest ona bardziej elastyczna.
Następnie Google poprosi Cię o zweryfikowanie własności Twojej witryny internetowej.
Można to zrobić na kilka sposobów. Wybierz dowolną metodę, a otrzymasz instrukcje dotyczące weryfikacji twojej witryny. Zalecamy skorzystanie z metody tagów HTML.
Zobaczysz teraz fragment kodu HTML, który musisz dodać do sekcji head twojej witryny internetowej WordPress.
Dodawanie kodu weryfikacyjnego Search Console za pomocą All in One SEO
Najpierw zainstaluj i włącz wtyczkę All in One SEO for WordPress. Aby uzyskać więcej informacji, zapoznaj się z naszym poradnikiem na temat instalacji wtyczki WordPress.
Uwaga: Istnieje również darmowa wersja All in One SEO, którą można wypróbować.
Po włączaniu przejdź do strony All in One SEO ” Ustawienia ogólne i kliknij Google Search Console.
Poniżej należy dodać kod weryfikacyjny skopiowany wcześniej z witryny internetowej Google Search Console.
Nie zapomnij kliknąć przycisku „Zapisz zmiany”, aby zapisać twoje ustawienia.
Następnie przełącz się z powrotem na kartę Google Search Console i kliknij przycisk „Weryfikuj”.
Gdy twoja witryna zostanie zweryfikowana, Google wyświetli tutaj raporty Search Console.
Musisz również upewnić się, że zarówno wersja https, jak i http są dodane do twojej Search Console.
Informuje to Google, że chcesz, aby wersja https Twojej witryny internetowej była traktowana jako wersja podstawowa. W połączeniu z przekierowaniami 301, które skonfigurowałeś wcześniej, Google przeniesie twoje rankingi wyszukiwania do wersji https witryny internetowej i najprawdopodobniej zauważysz poprawę w rankingach wyszukiwania.
Mamy nadzieję, że ten artykuł pomógł Ci dodać HTTPS i SSL w WordPress. Możesz również zapoznać się z naszym przewodnikiem po zabezpieczeniach WordPress z instrukcjami krok po kroku, aby Twoja witryna WordPress była bezpieczna lub z naszymi eksperckimi wyborami najlepszych rozwiązań analitycznych dla WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Kevin Bollhorst says
Thank you for this informative article. I am looking into switching my blog to SSL. The web host provider is Bluehost and I am using the free Cloudflare CDN Service. I have one question. Will Cloudflare’s free service support Bluehost’s Free SSL certificate?
WPBeginner Support says
Hi Kevin,
Please contact Bluehost or Cloudflare support, you may need additional configuration for SSL to work with your free Cloudflare CDN.
Administrator
Moritz Steiger says
I followed these instructions and now it has screwed my site, nothing works. I now get the 'White screen of death’ my host won’t help as they say it is a coding error and I am left in limbo.
WPBeginner Support says
Hi Moritz,
We are sorry to hear that. Please undo the steps you took while following the tutorial one by one and that should fix your site to normal.
Administrator
Chandra says
Hi,
Thank for you for such an detailed article on a very hot topic.
I followed manual steps but got mixed content error. And seems because of this I’m not able to see WP login page. I tried clearing cache on dreamhost but message displayed is „Unable to connect to CloudFlare”.
I’m using Dreamhost and Cloudflare is enabled.
Could you please help or need more details to fix the issue? Do you also offer paid service to secure another site of my mine?
Thank You.
WPBeginner Support says
Hi Chandra,
Please review your Cloudflare settings.
Administrator
Richard says
Hi,
Just followed through the manual procedure without problems – Thanks!
However, I’ve noticed that If I type the old http:// address into the browser for any page except for the homepage then the old http:// page loads.
Then when I click a link to another page it goes to a https:// page is this normal?
Does it indicate a problem with the redirect?
WPBeginner Support says
Hi Richard,
No it is not. Most likely the redirects in your .htaccess file are not working. Try copying the code and adding it to your .htaccess file again and see if this resolves the issue.
Administrator
Richard says
Hi,
Fixed It thanks. I’d originally inserted the Code at the end of the htaccess file. Moved It Up to before the WP section and everthing now works correctly.
Thanks for your help and for the concise guide. I’d been putting this off for a while.
Daniel says
With regard to the last step in Google Console, on the „Change of Address” page, I am getting a „no available sites” message, but I have double-checked that my http and https versions are verified. When I click on „add it now” I’m just getting verification information. What do I do?
Emily Randall says
I just installed a LetsEncrypt cert on my website, and I’m getting a bunch of insecure content errors that shouldn’t be happening. Although the theme is using get_template_directory_uri() to load its styles and scripts, those styles and scripts are still being loaded via http, not https. Even if I hard-code the https url in the function to load the styles/scripts, they’re loaded via http.
Do you have any idea what’s happening here? As far as I can tell, everything is set up properly, but it’s not working.
WPBeginner Support says
Hi Emily,
Try clearing WordPress cache.
Administrator
skaur says
Hi,
I have purchase SSL and configured by my hosting. It shows https in url. when I do https under General settings in wordpress admin area, my website goes down, only homepage and after it I am not able to login the admin area too. I added the code in htaccess file too with https under settings.
Could you help me with this?
Thanks
stan says
https://support.google.com/webmasters/answer/83106 says that
Note: The tool does not currently support the following kinds of site moves: subdomain name changes, protocol changes (from HTTP to HTTPS), or path-only changes.
WPBeginner Support says
Hi Stan,
Yes, we are aware of that. However, we still recommend taking this step. It is safe and will not have any negative impact on your site.
Administrator
Lindsey Bell says
I use Bluehost for web hosting and just set up my wordpress site with their free SSL certificate through the Bluehost page. There was a page on the Bluehost site to activate it for my WordPress site. Now, it appears that my site is already set up with the https. Do I still need to install the plug in, or is mine already taken care of? Thanks so much for the help!
WPBeginner Support says
Hi Lindsey,
You still need to install the plugin.
Administrator
Farukh hussain says
Hi,
I was founding this issue and you just uploaded this article. Thanks alot.
Can you please help? I did not change my primary site on search console. I added a new property with https and then created a set for all of them. Will it work fine for ranking or I need to follow your instructions only???
WPBeginner Support says
Hi Farukh,
Adding HTTPS property and then redirecting users from HTTP to HTTPs will work fine.
Administrator
Paula Jones says
So I have to purchase a dedicated IP address to use the free SSL certificate?
WPBeginner Support says
Hi Paula,
No, you don’t need a dedicated IP address to use free SSL certificate.
Administrator
Chris says
I don’t understand why a redirect is still necessary once the hosting service installs the certificate for the site. I’m assuming that a WordPress site initially configured with the HTTPS protocol does not require a redirect. Is it a matter of registering a domain with or without the proper protocol?
James Katt says
The problem of buying an SSL certificate and having it installed is that you will need to also purchase a fixed IP address from your Web Host. This is an additional yearly cost on top of the yearly cost of the SSL Certificate. For each website you create you have to buy an SSL certificate and a fixed IP address. This will add up tremendously the more websites you have.
Because of this, I prefer creating websites on hosts that Automatically give you a Free SSL certificate. These days, the ones that don’t simply want to gouge you for money.
Rupam krishna Bharali says
Can the internal configuration of SSL and HTTPS help to reduce the SSL loading time during a request? When I tested my website with SSL enabled and it took about 455 ms to load „the SSL separately”, but when I disabled the SSL total loading time decreased to 1.3s. So two question I want to ask you guys,
1. Can I go without an SSL just because I have a Simple blog, no commercial stuff, and web payments?
2. Can the configuration of SSL internally with the help of .htaccess file reduce the loading time of SSL?
WPBeginner Support says
Hi Rupam,
1. You can but soon Google will start warning users about websites not using HTTPs, this would affect your website’s traffic.
2. Yes, it can. You can also try to avoid plugins to fix mixed content issues. We have noticed that often such plugins increase page load time significantly.
Administrator
Adeshewa says
Could someone help please, I followed the direction of the first one all my pages are secure except for one on the menu. Whenever I clicked on it as a customer it says your connection to this website isn’t encrypted.
Troy says
Not sure if you got this fixed yet, but I was having the same issue. I found that using the SSL Insecure Content Fixer plugin corrected it. Worth a shot!
Shyam says
Hi wpbeginner,
My website did not have ssl certificate. I changed the http to https now it is showing ssl not enabled. What do I do?
Zohaib Sadique says
If you are working in WordPress then install the plugin named „really simple SSL” to force up your SSL. I hope you will get the idea. Thanks for reading.
Erin says
Thank you!! Finally I have my SSL certificate recognised by wordpress and I couldn’t have done it without the info provided here. So a BIG thanks for helping me out!
Farrukh Ghafoor says
I have added the code into the .htaccess file but when I refresh my page in WordPress it comes up with a „Your connection is not private” message. I have to click on „Back to safety” and the icon does not appear in the website url. Please help me to fix this. Thanks
Marco says
Where do you install WordPress? public_html or private_html ?
WPBeginner Support says
Hi Marco,
You need to install WordPress in public_html folder.
Administrator
Cecilia W says
I followed the first step, adding the https: to the website name and immediately the webpage redirected me to a sit not secure error prompt and now I can’t access my dashboard at all to finish the process or do any bug fixes. How do I reverse the first step?
Mark Lewis says
Thank you for this helpful article
Tammy says
I have used your site for a resource for a long time. Therefore, I was confident when I followed the directions in this article–to the letter. I used it on a client’s site. Which seemed to work perfectly. Then my own site. However, now I am locked out of both sites. I have a backup of them using the WP all-in-one migration plugin, but no way to access the dashboard.
One site says too many redirects. Even when going to an incognito window or a browser where I’ve recently deleted all history, it still says delete all cookies. The other site says can’t connect to server.
Any suggestions for me? I am pretty screwed at this point.
Thanks,
Tammy
WPBeginner Support says
Hi Tammy,
Please see our article on how to fix too many redirects issue in WordPress.
Administrator
Sukka says
Does my backlinks gets lost after change. Kindly some one clears it to me.
As when I checked my website through semrush https is showing 0 backlinks but I actually have 1000+ backlinks.
Please someone guide.
Thanks.
dan says
Why doesn’t the .htaccess stuff for Apache contain the 301 redirect information?
Divine says
This was really helpful. Though after doing it, it showed 404 in most pages but when I updated the paramalink…it was solved
Pipy says
Please, I am looking for some ways that I can do to secure the WordPress website from hackers and becoming a secure site. Suggest please
WPBeginner Support says
Please see our ultimate WordPress security guide.
Administrator
Ravi says
Hey wpbeginner team why you guys are not using ssl certificate.?
Waiting for your answer.
Reo says
Let me answer that. WPBeginner no need to use SSL because they don’t have a login/signup page and ecommerce.
SaifZiya says
But, hasn’t Google now announced that having an SSL certificate can boost your rankings in SERPS?
Cristi Adam says
Thank you for info man, great article, it really fixed my issue
Amar Patel says
after adding 's’ to the WordPress URL and site URL redirection is working properly…I removed the 's’ and put redirection code in my .htaccess then browser saying error too much redirection.
If i go for first option that will be fine or not ?….how can in know my redirection working properly ?
Nalin says
Hi,
Is it necessary to include the code in htaccess? I am using wordpress and checked with whynopadluck and manually changed the link of the images with non https link. After that, it shows all items are secure. Do I still need to update htaccess? Doesn’t WordPress redirect http to https by itself?
Mottaqi says
If I install a new WordPress installation for a new site should I do all of these???
Abiola Oyeniyi says
Cloudflare SSL or Let’s Encrypt which one is the best. I had to switch to Cloudflare SSL
Mukesh Patel says
If you are using cloudflare than you can easily switch your site to HTTPS. If you are using free plan then their are no option available for use custom SSL. If you install Let’s Encrypt SSL on origin server, Even after that browser will show Cloudflare SSL.
Richard says
Very helpful article. However, I am wondering if I would still be required to update the .htaccess file (per your example) if I am using the plugin: „Really Simple SSL” that you recommended in a newer article. (Also, would this plugin take care of changing the WP General Settings?)
Thanks!
James says
We completed step 1 and now we cannot login to our wordpress to do step 2 or 3. And the only page that works on our site it the home page. All other pages try to pull up as https and gives an error. We have to manually take the s out so it’s http before the page will show.
We’ve undone the first step and still cannot login. We are dead in the water here.
Jerome Williams says
Worked great. For people with self-signed certs yeah, you will get an error. But if you get that warning, that means you followed this tutorial correctly! All you have to do now is resolve your SSL signing issue and you’re set.
Bhupesh Pant says
Hi After making the above changes I am not able to open my site, I am not even able to login to my wp- admin page to revert https to http please help.
Enyel Cuadro says
(GoDaddy)
define(’FORCE_SSL_ADMIN’, true);
after adding this line then reload the website, I got error that „your connection is not private”. I am using self-signed certificate. Please help how to setup https using self-signed certificate.
Kimball says
Do a view source on your page. See anything that starts with http:// like css, js, or image files? Those will have to be changed in your content or template.
Mukesh Patel says
Do not use self-signed-certificate. You can choose Let’s Encrypt SSL, Free Comodo Certificate or Cloudflare SSL. These all are free of cost.
Ali O says
I know that WPBeginner is great, but you exceeded my expectations and totally saved my week today with this how-to guide! Love you guys!
Red Strivens says
Remember to change the Port as well !!!!
Mari-Lyn says
Thank you for the simple explanation of making a site ssl compliant.
Bala krishna reddy mogiligundla says
Sir i have stuck in a problem i hope you could help , i have a hosting which is worth $300 in godaddy i have added one website and bought an ssl for that …again after some days i have added secondary site avantsolutions.ca to same hosting . i have been told that i cannot buy additional ssl to this hosting and suggested me to buy one unified ssl which costs around 350$ .Please dont mind me saying this but i have already spent alot and cant afford that ..what other options do i have
WPBeginner Support says
Hello Bala Krishna,
Please try to resolve it with your hosting provider through live chat or phone support. If you have purchased a hosting plan that doesn’t meet your needs, then you can ask them for a refund. Most hosting companies have some sort of refund policy which is usually valid during the first 30 days of signup.
Administrator
Lydia says
Hi, my host offers the Let’s encrypt so I have gone that route, as this is all new I have created a new site to practice on which i set up the lets encrypt shared ssl. Now I am trying to move it from http to https I did install the simple ssl plugin but it did not find my ssl certificate, not sure if it is set to work with shared lets encrypt so, i found another plugin called wp encrypt which is designed specifically for the shared lets encrypt but i am not able to get it to connect the way it instructs. I have checked my outgoing connections and they are clear. Would appreciate any help in working this process out, so I can get started on the shift. Thanks
Max says
Followed the instructions and basically bricked my website.
between 404 errors, database connection errors and more and more errors… that 301 redirect causes way too many problems.
Brian Luff says
Thanks for the article, which is interesting and informative. There’s one problem it doesn’t mention, and no-one else has commented so I wonder if I’m missing something.
I bought a third-party SSL certificate from the hosting company and switched to HTTPS. After making the .htaccess changes, everything worked fine, except…
None of the pages get a green padlock. Instead, there’s an info link that says the pages are 'partially secure’.
I checked with the hosting company, and they said I had to change every internal link to HTTPS, and the URL of every image likewise. If I don’t do that, then no green padlock.
Manually making all those changes would take me months even if I worked 8 days per week, 25 hours per day. If I’d known that at the outset, I would not have made the change to SSL/HTTPS in the first place.
Is what I’m being told correct? If so, is there any (even semi-)automated way of updating all the links in the site?
WPBeginner Support says
Hi Brian,
You can install Really Simple SSL plugin and it will take care of partially insecure links on your website.
Administrator
Brian Luff says
Many thanks for that, I’ll remember it for next time (I have a personal blog I’m thinking about moving from .com to .org). In this case I already bit the bullet. It turns out I was exaggerating but it did take me several hours to go through 200 posts and 70 pages manually changing all the internal links and the image references. At the end of all that, there was still no green padlock, but I found the last few instances using a useful (free) tool (which may or may not be a useful adjunct to your plugin). I now have another question, but I’ll post it separately for clarity. Thanks again for responding.
WPBeginner Support says
Hi Brian,
Glad to know that you fixed it
Felix says
Hi Brian,
There is another ultimate solution for that problem. Try to make Backup of MySQL database of your site manually by the procedure:
https://www.wpbeginner.com/beginners-guide/how-to-make-a-wordpress-database-backup-manually/
OR.
Almost any hosting provider has an option such as „download MySQL database” or „dump MySQL database”. You will download .sql file. After that open that .sql file in text editor such notepad++ and try the find-replace function to find „http” and replace it by „https”. It will take a second.
hiren says
hii,
I does the changes as above in my site but now it is getting problem ” Error establishing a database connection”
so i’ve no idea where to do changes .
pls help. thanks in advance.
Lisbeth says
What to do if I want to revert back from https to http?
There aren’t many guides on this one. Please help.
Tom W says
A quick update – there is a free plugin called Really Simple SSL that you can download, activate, and it works great!
Many thanks to the author.
Jason says
I tried this and had a problem. I switched from a basic html/htm site to wordpress so my .htaccess has a lot of 301 redirects. No I’ve bought an SSL In the current setup if I add RewriteRule ^(.*)$ to the .htaccess file then if anybody attempts to browse the site they get „the webpage has a redirect loop” error. So I’ve had to take out that line of code. Anything I can do?
Avinash Kumar says
I am using cloudflare for https and want to know how to display „secure lock sign” before the https:// and I also want to know why you are not using https ?
hiren says
Just install a Really simple SSL plugin and active it. and change in the yor site general setting it is Setting >> General >> https://example.com
Mukesh Patel says
Hello Avinash Kumar.
wpbeginner don’t use HTTPS because they don’t have any login, signup page and also don’t sale anything.
WPBeginner Support says
Hi Avinash and Mukesh,
Actually, we have moved to HTTPS recently.
Administrator
Bart Nash says
When configuring the SSL certificate, is it better to add the www to https:// or leave off the www when setting up a new wp site.
WPBeginner Support says
Hi Bart,
See our guide on www vs non-www.
Administrator
tim says
Reason when I complete all the steps. Thank you for your article! I was wondering though, my website recently has suffered some problems with.