• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Installing SSL for codeigniter

#1
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
Reply

#2
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>
Reply

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

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

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

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

#6
(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
.
Reply

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

#8
(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
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.