CodeIgniter Forums
Installing SSL for codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Installing SSL for codeigniter (/thread-76031.html)



Installing SSL for codeigniter - rrashid090 - 04-08-2020

Dear All,

I have just installed SSL for my site. and put following in htaccess for redirection.

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

Now home page is working fine, but when i tried to open Admin Page or any other page it gives 404 error.

then i removed above code from htaccess and try open manually by writing **redacted**, then its working absolutely fine for all pages.

Please guide me accordingly.
Thanks


RE: Installing SSL for codeigniter - jreklund - 04-08-2020

Hi, try the following instead.
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    # Force HTTPS.
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Remove the www
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>



RE: Installing SSL for codeigniter - dave friend - 04-09-2020

Make sure that $config['base_url'] is using the https protocol, for example

PHP Code:
$config['base_url'] = 'https://example.com/'



RE: Installing SSL for codeigniter - rrashid090 - 04-15-2020

I did the same as above provided instructions. but same error. as home page is working fine but all other pages showing 404 error.


RE: Installing SSL for codeigniter - jreklund - 04-17-2020

404 errors should not be due to SSL, does them work without HTTPS?


RE: Installing SSL for codeigniter - rrashid090 - 04-20-2020

(04-17-2020, 12:46 PM)jreklund Wrote: 404 errors should not be due to SSL, does them work without HTTPS?

Yes site is working will without https.
even if i addressed manually type site name with "https" then site working well. but if i made a change in htaccess file then error is coming only
.


RE: Installing SSL for codeigniter - jreklund - 04-20-2020

Can you post your complete .htaccess, to see if you have multiple entries of the same thing.


RE: Installing SSL for codeigniter - rrashid090 - 04-20-2020

(04-20-2020, 09:14 AM)jreklund Wrote: Can you post your complete .htaccess, to see if you have multiple entries of the same thing.
below you can htaccess file code for **redacted**
Code:
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##

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

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73___lsphp .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit