Welcome Guest, Not a member yet? Register   Sign In
Removing .php extension gives 404
#1

Hi, I have integrated a CMS (simplece) which is built based on CodeIgniter (version 3x). When I integrate the code into a page (i.e., including the php code on the top of the page), then removing .php extension returns 404 error! I have tried all different redirecting and rewriting tricks in .htaccess, but no success! Helps are much appreciated.
Reply
#2

(01-07-2022, 05:51 AM)sj2022 Wrote: Hi, I have integrated a CMS (simplece) which is built based on CodeIgniter (version 3x). When I integrate the code into a page (i.e., including the php code on the top of the page), then removing .php extension returns 404 error! I have tried all different redirecting and rewriting tricks in .htaccess, but no success! Helps are much appreciated.

I should add one thing: if I would set $config['enable_query_strings'] = TRUE; then the code works, with extension-free URL, but the other functionalities of the main code (CodeIgniter) stop working!
Reply
#3

Since this is a paid product, maybe you should first try asking them?
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#4

Thanks includebeer, but it shouldn't do anything with that product (I have anyhow asked them -- no response). The conflict arrises from the $config['enable_query_strings']. If this is set 'TRUE' then the https://example.com/file is shown correctly (file is actually file.php; the extension has been removed with .htaccess), but then the 'string' url (e.g., https://example.com/simplece/content/tex...l=https%3A%....; I have removed the index.php) is not shown (just a blank white page). When the $config['enable_query_strings'] is set 'False', then the https://example.com/file returns 404, but the string url is shown correctly!
Reply
#5

After spending several hours, going through the entire CodeIgniter scripts, I found a hack. Not ideal, but works fine for me.

Under system/URI.php, within the public function __construct(), based on current full URL, I switch between $protocol = 'REQUEST_URI' and $protocol = 'QUERY_STRING', when the URL includes and does not include the name of the application's folder, respectively.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB