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

Posted March 6, 2018 8.1k views
ApacheServer OptimizationWordPress


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 to

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: to


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer


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>
        Redirect "/" ""

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

        Redirect "/" ""

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.


Submit an Answer