Hi!
I wish to make it so, that when anyone accesses my site, via mysite.com/index.php or mysite.com/index.php/existing-page they would get 404.
By default it works so that if you go to mysite/index.php you get to / and if to mysite.com/index.php/existing-page you get /existing-page.
What I did:
- Set public string $indexPage = ''; in Config/App.php
- Read through https://codeigniter.com/user_guide and searched https://forum.codeigniter.com/
- Found this rule for .htaccess (below), but it redirects /index.php/existing-page to /existing-page (which the best solution so far):
# Remove index.php from URL
RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
Also, maybe I'm using CI4 in a wrong way? I'm new to the framework. I want to set some concrete rewrites like mysite.com, mysite.com/about, mysite.com/shop, etc. All else yields you 404.
Thank you very to anyone who would help me
I wish to make it so, that when anyone accesses my site, via mysite.com/index.php or mysite.com/index.php/existing-page they would get 404.
By default it works so that if you go to mysite/index.php you get to / and if to mysite.com/index.php/existing-page you get /existing-page.
What I did:
- Set public string $indexPage = ''; in Config/App.php
- Read through https://codeigniter.com/user_guide and searched https://forum.codeigniter.com/
- Found this rule for .htaccess (below), but it redirects /index.php/existing-page to /existing-page (which the best solution so far):
# Remove index.php from URL
RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
Also, maybe I'm using CI4 in a wrong way? I'm new to the framework. I want to set some concrete rewrites like mysite.com, mysite.com/about, mysite.com/shop, etc. All else yields you 404.
Thank you very to anyone who would help me