1

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]  
Community
  • 1
  • 1
Kuf
  • 17,318
  • 6
  • 67
  • 91
  • When the requested URI is `/Uploader2.7.0/secureFileUploader.php` you want it to be internally rewritten to `/uploader/upload` only ? Or to `/uploader/upload/something_else` ? Please tell what **exactly** are urls for **old** and **new** pages – Justin Iurman Aug 28 '14 at 10:26
  • sorry if it wasn't clear, i've added the missing information. – Kuf Aug 28 '14 at 11:17

1 Answers1

0

put your .htacces file at same level of application, user_guide folder. So u have total 6 file in your codeigniter folder including index.php and license text document as well as .htaccess file.

This image is useful for you

Kakshak
  • 59
  • 1
  • 1
  • 7
  • That's the setup i am using. .htaccess rerouting works fine, codeigniter works perfectly, the issue is with the CLI and the codeigniter internal routing – Kuf Aug 28 '14 at 21:53
  • Okay, I thought that your .htaccess code is going well. – Kakshak Aug 29 '14 at 04:32