2

Early my site has no SSL certificate so baseurl for webservice was http://test.com/webservice/index.php. Now I am going to move my site to HTTPS. So when I tested webservice. All webservice showing unknown method. The base_url is hardcoded in android and iOS. So is there any way to redirect the http call to https. Otherwise app will be crashed. Whether Writing redirection in .htaccess file can solve this issue.

Ayyappa amara
  • 437
  • 3
  • 16
Rahul K R
  • 191
  • 4
  • 20
  • If it were a webpage there are a few tricks you can use. Since you "hardcoded" the url in your apps I worry you painted yourself into a corner. I'm curious myself if there is a solution... – Rob C Jan 12 '18 at 04:55
  • you can check : https://stackoverflow.com/questions/13376219/htaccess-redirect-http-to-https – Ravi Sachaniya Jan 12 '18 at 05:56

1 Answers1

0

.htaccess can be used to force https. The following usually works for CodeIgniter on Apache.

RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
DFriend
  • 8,869
  • 1
  • 13
  • 26