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 comment
  • HTTPS Redirection in Apache
    Login to your Apache server and go to the path where it’s installed.
    Go to the conf folder and take a backup of httpd.conf file
    Open httpd.conf using your vi editor (choose your favorite editor)
    Ensure modrewrite.so module is loaded
    LoadModule rewritemodule modules/modrewrite.soCopy
    If you see above line is commented then uncomment it
    Add the following at the end of the file
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTPHOST}%{REQUEST_URI}Copy
    Restart Apache web server to test it.
    A configured website should be able to redirect and accessible on https.

    HTTPS Redirection in Nginx
    Login to the Nginx web server and take a backup of nginx.conf or default.conf file (whatever file you are using for server directive)

    Add the following in server directive
    return 301 https://$servername$requesturi;Copy
    Save the file and restart Nginx web server.
    Restart Nginx to test the site.

    HTTP Redirection in Cloudflare
    If you are leveraging Cloudflare for performance and security, then having a website through HTTPS is very easy.

    Login to Cloudflare >> select the site
    Go to SSL/TLS tab >> Edge Certificates
    cloudflare-https

    Ensure it turned ON
    There is another way, page rules.

    Go to Page Rules
    Click “Create Page Rule”
    Enter the URL (put the asterisk, so redirection happens for all the URI)
    Click “Add a Setting” and select “Always Use HTTPS” from the drop-down
    cloudflare-pagerules

    Click “Save and Deploy”
    It will take a few seconds, and you are all set to have your website accessible through https. After using Cloudflare, if your site breaks due to mixed content, then check out the following guide.

    my site :-[www.lyrics-hindi-songs.in]

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.

×
5 answers

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

Hello,

You can try with some of the following rules:

The following forces any http request to be rewritten using https. For example, the following code forces a request to http://example.com to load https://example.com. It also forces directly linked resources (images, css, etc.) to use https:

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

The below code when added to an .htaccess file will automatically redirect any traffic destined for http: to https:

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

Let me know how it goes.

Regards,
Alex

HTTPS Redirection in Apache

Login to your Apache server and go to the path where it’s installed.
Go to the conf folder and take a backup of httpd.conf file
Open httpd.conf using your vi editor (choose your favorite editor)
Ensure modrewrite.so module is loaded
LoadModule rewrite
module modules/modrewrite.soCopy
If you see above line is commented then uncomment it
Add the following at the end of the file
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP
HOST}%{REQUEST_URI}Copy
Restart Apache web server to test it.
A configured website should be able to redirect and accessible on https.

HTTPS Redirection in Nginx
Login to the Nginx web server and take a backup of nginx.conf or default.conf file (whatever file you are using for server directive)

Add the following in server directive
return 301 https://$servername$requesturi;Copy
Save the file and restart Nginx web server.
Restart Nginx to test the site.

HTTP Redirection in Cloudflare
If you are leveraging Cloudflare for performance and security, then having a website through HTTPS is very easy.

Login to Cloudflare >> select the site
Go to SSL/TLS tab >> Edge Certificates
cloudflare-https

Ensure it turned ON
There is another way, page rules.

Go to Page Rules
Click “Create Page Rule”
Enter the URL (put the asterisk, so redirection happens for all the URI)
Click “Add a Setting” and select “Always Use HTTPS” from the drop-down
cloudflare-pagerules

Click “Save and Deploy”
It will take a few seconds, and you are all set to have your website accessible through https. After using Cloudflare, if your site breaks due to mixed content, then check out the following guide.

[Lyrics Hindi Songs](https:/lyrics-hindi-songs.in/)[https:/lyrics-hindi-songs.in`“<a href="https://
www.lyrics-hindi-songs.in/”>Lyrics Hindi Songs</a>

HTTPS Redirection in Apache
Login to your Apache server and go to the path where it’s installed.
Go to the conf folder and take a backup of httpd.conf file
Open httpd.conf using your vi editor (choose your favorite editor)
Ensure modrewrite.so module is loaded
LoadModule rewrite
module modules/modrewrite.soCopy
If you see above line is commented then uncomment it
Add the following at the end of the file
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP
HOST}%{REQUEST_URI}Copy
Restart Apache web server to test it.
A configured website should be able to redirect and accessible on https.

HTTPS Redirection in Nginx
Login to the Nginx web server and take a backup of nginx.conf or default.conf file (whatever file you are using for server directive)

Add the following in server directive
return 301 https://$servername$requesturi;Copy
Save the file and restart Nginx web server.
Restart Nginx to test the site.

HTTP Redirection in Cloudflare
If you are leveraging Cloudflare for performance and security, then having a website through HTTPS is very easy.

Login to Cloudflare >> select the site
Go to SSL/TLS tab >> Edge Certificates
cloudflare-https

Ensure it turned ON
There is another way, page rules.

Go to Page Rules
Click “Create Page Rule”
Enter the URL (put the asterisk, so redirection happens for all the URI)
Click “Add a Setting” and select “Always Use HTTPS” from the drop-down
cloudflare-pagerules

Click “Save and Deploy”
It will take a few seconds, and you are all set to have your website accessible through https. After using Cloudflare, if your site breaks due to mixed content, then check out the following guide.

[www.lyrics-hindi-songs.in](http://)

HTTPS Redirection in Apache
Login to your Apache server and go to the path where it’s installed.
Go to the conf folder and take a backup of httpd.conf file
Open httpd.conf using your vi editor (choose your favorite editor)
Ensure modrewrite.so module is loaded
LoadModule rewrite
module modules/modrewrite.soCopy
If you see above line is commented then uncomment it
Add the following at the end of the file
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP
HOST}%{REQUEST_URI}Copy
Restart Apache web server to test it.
A configured website should be able to redirect and accessible on https.

HTTPS Redirection in Nginx
Login to the Nginx web server and take a backup of nginx.conf or default.conf file (whatever file you are using for server directive)

Add the following in server directive
return 301 https://$servername$requesturi;Copy
Save the file and restart Nginx web server.
Restart Nginx to test the site.

HTTP Redirection in Cloudflare
If you are leveraging Cloudflare for performance and security, then having a website through HTTPS is very easy.

Login to Cloudflare >> select the site
Go to SSL/TLS tab >> Edge Certificates
cloudflare-https

Ensure it turned ON
There is another way, page rules.

Go to Page Rules
Click “Create Page Rule”
Enter the URL (put the asterisk, so redirection happens for all the URI)
Click “Add a Setting” and select “Always Use HTTPS” from the drop-down
cloudflare-pagerules

Click “Save and Deploy”
It will take a few seconds, and you are all set to have your website accessible through https. After using Cloudflare, if your site breaks due to mixed content, then check out the following guide.

[www.lyrics-hindi-songs.in]

Submit an Answer