Search code examples
phpcodeignitergodaddy-api

How to remove File Extension (index.php ) from URL using .htaccess


I'm unable to remove file extension from my URL

https://www.deemsolar.com/ar/index.php

This is the current URL of my website

I want to change this as https://www.deemsolar.com/ar/

Please Help me out?


Solution

  • Add this in your .htaccess file

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

    Note: make sure that in config.php file,

    $config['index_page'] = "";
    $config['uri_protocol'] = "REQUEST_URI";