To remove index.php from the URL in CodeIgniter when using HTTPS and AWS, you need to follow these steps:

  1. Configure CodeIgniter for Clean URLs: First, make sure that your CodeIgniter application is configured to use clean URLs without the index.php in the URL. This can be achieved by enabling the index_page setting in the config.php file:

    // application/config/config.php $config['index_page'] = '';

    Additionally, you may need to set up .htaccess rules to remove index.php from the URL. Ensure that your web server (Apache or Nginx) allows the use of .htaccess and has the necessary rewrite rules configured.

  2. Configure HTTPS on Your AWS Server: Set up HTTPS on your AWS server by obtaining an SSL certificate and configuring the web server (Apache or Nginx) to serve the application over HTTPS. This ensures that your CodeIgniter application is accessible via the https:// protocol.

  3. Update Your AWS Security Group: Make sure your AWS security group allows incoming HTTPS (port 443) traffic to your server.

  4. Update CodeIgniter Base URL: Update the base URL in your CodeIgniter application's config.php file to use https:// instead of http://. This will ensure that CodeIgniter generates URLs with https:// when constructing links and assets.

    // application/config/config.php $config['base_url'] = '';
  5. Update the .htaccess File (Apache) or Configuration (Nginx): Ensure that your .htaccess file (if you're using Apache) or server configuration (if using Nginx) is set up correctly to handle clean URLs and remove index.php from the URL. Below is an example .htaccess file for Apache:

    RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L]
  6. Restart the Web Server: After making changes to your server configuration files, restart the web server to apply the changes.

With these steps, your CodeIgniter application should now be accessible via HTTPS without the index.php in the URL. Visitors to your website will see clean URLs using the https:// protocol, providing a secure browsing experience. Additionally, make sure your .htaccess file is correctly handling clean URLs, and your AWS security group allows incoming HTTPS traffic on port 443.

Have questions or queries?
Get in Touch