I used the following .htacces
to route from an old page to a new one:
RewriteEngine on
RewriteCond %{REQUEST_URI} /Uploader2.7.0/secureFileUploader.php
RewriteRule ^(.*)$ /uploader/upload [L,QSA]
Even though the rewrite rule is correct, I got a '404 page not found' error. This .htacces
is at the root of my site.
Based on this answer, I changed:
$config['uri_protocol'] = 'AUTO';
to
$config['uri_protocol'] = 'REQUEST_URI';
And that made the reroute rule work fine, but the CLI stopped working. Then I saw this question which says it will work if I will change the 'uri_protocol' back to
$config['uri_protocol'] = 'AUTO';
Is there a way to make both work?
Note: the rewrite rule works, the issue is with the CodeIgniter internal routing. I can make it work either with the RewriteRule
rule or with CLI, not both.
EDIT:
I want the url /Uploader2.7.0/secureFileUploader.php
to become /uploader/upload
internally, which i managed to do using the rule above.
/uploader
in the path of Codeigniter index.php
, and upload
is the name of the controller I wish to route to.
Under /uploader
I have the .htaccess
file to hide the index.php
of CodeIgniter, which works perfectly:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]