CodeIgniter Forums

Full Version: Installing SSL for codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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>
Make sure that $config['base_url'] is using the https protocol, for example

PHP Code:
$config['base_url'] = 'https://example.com/'
I did the same as above provided instructions. but same error. as home page is working fine but all other pages showing 404 error.
404 errors should not be due to SSL, does them work without HTTPS?
(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
.
Can you post your complete .htaccess, to see if you have multiple entries of the same thing.
(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