I want to redirect all of my HTTP requests to my HTTPS (SSL) protocol. Please guys this is not a duplicate. I have already tried every question found on SO which indicate such question but none of them worked. I tried everything I found on the internet but still cannot figure out what the problem is. May be somewhere something has to be enabled or something like that.
I want to redirect from my httpd.conf
file not from .htaccess
because this is what suggested by Apache Org. My current Redirection Rule is
<VirtualHost *:80>
ServerName www.example.com
Redirect / https://www.example.com/
</VirtualHost >
<VirtualHost *:443>
ServerName www.example.com
</VirtualHost >
I am making all of these changes in my httpd.conf
file located in /etc/httpd/conf/httpd.conf
After every change, I also restart my server with following /etc/init.d/httpd restart
or service httpd restart
I also tried following
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}/%$1 [R,L]
But still when I visit my site like www.example.com
, I am not redirected to https://www.example.com
.
I have a VPS Server so has enough access to my machine to enable or disable something.