Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
1.6k views
in Q2A Core by
I installed ssl certificate

I need to make the traffic force https by modifying  .htaccess 301 or 302 redirect

Please provide me suitable solution
Q2A version: 1.7.4

3 Answers

0 votes
by
You can use cloudflare pages rules
by
I did try it the website go offline
Am I have to remove the .htaccess file while enable the cloudflare redirect ?
I am using comodo SSL can I use cloudflare with it ?
+1 vote
by
Modify from your control panel of your hosting the necessary parameters
You do not need to change .htaccess
+1 vote
by
Put this at the very top of your htaccess file: This is what I use on my website.

If you don't get 'secure' in the address field in your browser it will probably be because you need to make all url's relative and not absolute.

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
by
Just to confirm, is that how my htaccess file should look like then:

DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
Header set Access-Control-Allow-Origin "*"
#RewriteCond %{REQUEST_URI} !^/files/.*$
RewriteRule ^(files)($|/) - [L]

RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php?qa-rewrite=$0&%{QUERY_STRING} [L]
</IfModule>
...