I tested this on a fresh Codeigniter 3.1.11 (didn't work on 3.1.10 either) and have no idea why it doesn't work
Code:
https://www.mydomain.com/welcome/index
https://www.mydomain.com/index.php/welcome/index
https://www.mydomain.com/index.php?/welcome/index
These URL are working fine directly from browser no problem with them.
Now I need to rewrite some existing static pages to codeigniter controllers. In this case just for testing codeigniter welcome page. First of all to make sure RewriteRule works as expected I tested it with a regular php file i created. And it works fine.
Remember I need rewrite not redirect.
Code:
RewriteRule ^(staticpage_(?:\d+)\.html)$ myphpcode.php [L]
Code above is working fine.
Problem is when i try codeigniter instead of myphpcode.php
If I try lines below all of them returns Codeigniter's Page Not Found error.
Code:
RewriteRule ^(staticpage_(?:\d+)\.html)$ /welcome/index [L]
Code:
RewriteRule ^(staticpage_(?:\d+)\.html)$ index.php/welcome/index [L]
Code:
RewriteRule ^(staticpage_(?:\d+)\.html)$ index.php?/welcome/index [L]
If I set
enable_query_strings to
TRUE rewrite works but I don't want to enable it. Also config documentation clearly says that
Please note that some of the helpers won't work as expected when this feature is enabled, since CodeIgniter is designed primarily to use segment based URLs.
Any other way to rewrite existing static content to codeigniter controllers?