Error while adding redirect (301) rule on Cpanel to force ssl - ssl

I am new to server and cpanel. I have successfully purchased and installed ssl certificate on my domain. Now when I try to add redirect (301) for http to HTTPS for all traffic under cpanel its giving error " The is error in Apache rule while processing your request".
Please help

Cpanel official documents says:
If you try to setup a Dedicated SSL redirect using the cPanel steps
, cPanel will fail with an error message.
Its best you write your rewrite rules directly into .htaccess file under your root directory.
See here for inmotion hosting help page
Try this in .htaccess:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

Related

Error SSL CloudFlare install hosting Cpanel "ERR_SSL_VERSION_OR_CIPHER_MISMATCH"

I will share with you a case when installing SSL Free provided by CloudFlare and installing
Key + Cert on hosting when accessing with Chrome error "ERR_SSL_VERSION_OR_CIPHER_MISMATCH" try with Firefox "Secure connection failed and firefox did not connect" I have searched through some informative websites and found out do "You should turn on 'Always use HTTPS' as well as 'Automatic HTTPS Rewrites' on that SSL/TLS app, this will make sure all resources are loaded over HTTPS including the main page" and I am using Wordpress source code web, just adding rule in .htaccess force HTTPS solved this error and successfully accessed the website.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Successfully processed

My homepage wont go through HTTPS port

So my domain is [1] and as you can see whenever you go on that link it will get HTTP (without padlock) but if you go to any other link it will be HTTPS. Only my homepage goes through HTTP.
Important things to mention is that I use Apache.
Every my attempt to edit .htaccess file ends up by website stoping to work. My whole website is hosted on AWS and that is where I derived my SSL certificate.
I want to make that homepage load in HTTPS as well.
How should I do that?
Here is my app folder and place where I created my .htaccess file.
[1]:
Adding this to your .htaccess should do it:
RewriteEngine on
RewriteCond %{HTTPS} =off
RewriteRule ^$ https://www.urtina.com/ [L,R=301]
If it breaks Apache, check the error log. It is for the homepage only as requested.

HTTPS redirection on AWS ELB

We have web servers running Apache behind an AWS ELB. I have setup the ELB to accept HTTPS connections, and send the requests over HTTP to the webservers. This works fine.
I have also redirected all the requests to ELB from HTTP to HTTPS using HTTP:X-Forwarded-Proto.
I have added the below virtualhost section to my httpd.conf file and restarted Apache. This setup is redirecting HTTP requests to HTTPS but it is landing on the Apache home page instead of the expected site.
ServerName www.myexample.com
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule !/index.html https://%{SERVER_NAME}/%{REQUEST_URI} [R=301,L]
The configuration seems to be simple and straightforward but not working.
Please let me know what is wrong in the above setup and why is it landing on the Apache home page.
You should escape the . in your rewrite rule. Change your Rewrite to be:
RewriteRule "!/index\.html" https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Also, as in the comment to your OP Remove the slash between %{HTTP_HOST}%{REQUEST_URI}

Redirect from https to http url stored from google

in a search from google , i found my domain url with https and not http .
For example : https://xxxx.com/yyyy/zzzz and not http://xxxx.com/yyyy/zzzz
It's possible redirect from https to http for the domain xxxx.com ?
I use centos and apache web server
On the same server, i have a certificate https that respond to https://zzzz.com
Thanks
Carlo
This will work with mod_rewrite on. Put this code in .htaccess file at root of the site.
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}

Disable https on localhost

I need to automatically redirect any https:// to http:// on my localhost environment.
I tried to use a .htaccess file which I placed on my htdocs/ with the following code:
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
For some reason this is not working. Any advice?
The problem with the rewrite rule is that it will never be reached if apache is not configured properly for SSL. The browser is trying to connect to http://localhost:443 and unless apache or some other service is configured on that port you'll get a timeout.
The best solution would be to create a self-signed certificate for apache running on localhost and create a rule in your web browser to trust the certificate:
Create a self-signed certificate for apache:
http://www.perturb.org/display/entry/754/