How can redirect my all posts/page from Http to Https

March 6, 2018 1.8k views
Apache WordPress Server Optimization

Hello,

I failed to fix my this problem. Http to https redirect.

Actually recently I updated my website with SSL certificate in that everything is done.
I have added redirect code in my .htaccess file.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTPHOST}%{REQUESTURI} [L,R=301]

But only Homepage working perfect.
It's automatically redirecting
http://www.lyricstake.com to
https://www.lyricstake.com

But all others page/post did not get redirecting.

I am using wordpress, please give me solution for post redirecting.

I want redirect my all post automatically.
Example:
http://www.digitalocean.com/community/questions to
https://www.digitalocean.com/community/questions

Thanks
Imran

1 Answer

Imran

You can redirect all of your http requests to https for all pages in the domain either from the apache2.conf file

Open the editor from the terminal

sudo nano /etc/apache2/apache2.conf

and add this block of code at the end of the file

<VirtualHost *:80>
        ServerName www.lyricstake.com
        Redirect "/" "https://www.lyricstake.com/"
</VirtualHost>

You can also do this from the virtual host file

sudo nano /etc/apache2/sites-available/default

Add the following two lines inside the <VirtualHost *:80> tags

        ServerName www.lyricstake.com
        Redirect "/" "https://www.lyricstake.com/"

Follow this guide if you get into trouble:
Configure Apache

Good luck

by Josh Barnett
SSL is a web protocol used to encrypt a site's information and create a more secure connection. The certificate system also assists users in verifying the identity of the sites that they are connecting with. In this guide, we will show you how to set up a self-signed SSL certificate for use with an Apache web server on a CentOS 7 VPS.
  • Hello,

    Thanks for reply and thanks to give solution.

    But it's not work.

    I had use both method, but it's didn't redirecting.

    Only Homepage working.
    Other pages not recreation.

    i really tired to fix it. I have done everything but all failed.

    Please check again my issues
    Give me a hard solution.

    Thanks
    Imran

Have another answer? Share your knowledge.