.htaccess - Redirect every request from https to http in codeigniter -


my htaccess looks :

rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l]  rewritecond %{https} on rewriterule (.*) https://%{http_host}%{request_uri} [r=301,l] 

if user opens url https://example.com. should redirect http://example.com.

but when open url https://example.com gives this webpage not available.

i tried 1 more code redirect https http in config.php:

if($_server['https'])  {           $host = $_server['http_host'];          $request_uri = $_server['request_uri'];          $good_url = "http://" . $host . $request_uri;          $config['base_url'] = $good_url;         header( "http/1.1 301 moved permanently" );          header( "location: $good_url" );          exit;  } 

none of them works.

your .htaccess code incorrect.

the code used (shown below) says, "if https on, redirect https version," not want.

rewritecond %{https} on rewriterule (.*) https://%{http_host}%{request_uri} [r=301,l] 

in addition, rule placed @ bottom of file, not @ top.

to fix it, use following .htaccess instead:

rewriteengine on  # turn off https rewritecond %{https} on rewriterule ^ http://%{http_host}%{request_uri} [r=301,l]  # send else ci front controller rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule .* index.php/$0 [pt,l]  

be sure remove code added config.php - not necessary.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -