I created a CodeIgniter 3 application and I'm trying to redirect all the URLs with index.php to URLs without it.
My .htaccess is:
RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/?$1 [L,QSA]
I'm facing the problem that both the URLs with and without index.php are redirecting on the same page. For example:
https://www.example.com/ and https://www.example.com/index.php
redirecting to the same page.
Also, when I try to apply the index.php on sub-routes like https://www.example.com/index.php/abc, javascript doesn't load.
I've followed this answer but doesn't work in my case: Redirect index.php in CodeIgniter
Thank you
.htaccess/mod_rewrite directives rewrite the request toindex.php/?<url>(a single slash for path-info and the requested URL contained in the query string). However, your example/index.php/abcpasses the URL as path-info only, no query string? So, which is it? Both? Or more? eg./index.php?abc,/index.php/?abc,/index.php/abc?