Redirect http to https using htaccess

Today we are going to show you how to Redirect from http to https using .htaccess file in codeigniter. If you have a website with HTTP and you have purchased the SSL for your site then you want to redirect from http to https it’s hard but not impossible to manage redirection because till now every request to your site has HTTP before any request so how can redirect your every request code is below.This code will be work with several condition: phpkida.com to https://www.phpkida.com http://www.phpkida.com to https://www.phpkida.com https://phpkida.com to https://www.phpkida.com

http to https htacces example 1

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [OR]
RewriteCond %{HTTP_HOST} ^phpkida\.com$ [NC]
RewriteRule ^ https://www.phpkida.com%{REQUEST_URI} [R=301,L,NE]
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php(/[^\ ]*)?\ HTTP/ 
RewriteRule ^index\.php(/(.*))?$ phpkida.com/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

http to https htacces example 1

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.phpkida.com/$1 [R,L]

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www.phpkida.com [NC]
RewriteRule (.*) https://www.phpkida.com/$1 [R=301,L]

You can also redirect http to https using php

Tags:

redirect to www htaccess codeigniter, codeigniter https htaccess, codeigniter: https not working, redirect http to https htaccess, codeigniter htaccess, redirect non www to www https, use ssl in codeigniter, htaccess redirect, Redirect from http to https using .htaccess file in codeigniter, How to redirect http to https in codeigniter

Leave a Reply

Related Posts: You may like

Minify HTML in CodeIgniter using Hooks

How to execute mysql query inside codeigniter helper

Upload and Resize Image and Create Thumbnail Codeigniter

Rename file while uploading in codeigniter

Tools:

Crypto Currency

PHPKIDA provides free online the best real-time crypto market price, news, predictions, index with graphs & historical data for 2000+ coins including bitcoin, ethereum, & altcoins from major cryptocurrency exchanges.

Visite Tool

Icon Generator

PHPKIDA provides free online icon generator. Our icon generator help you to edit, modify, resize and customize icon for your website and applications. Convert to a shap you like add icon border, you can change icon border color, border size, background color, icon shadow, icons color, icon size in your own way and save it as a png image.

Visite Tool

Youtube Video Downloader

PHPKIDA provides Free online YouTube video downloader to download YouTube videos quickly in MP4, 3GP, and more. Search your video and free fast download youtube videos.

Visite Tool

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.