[eluser]kettch[/eluser]
I've had a client website using CodeIgniter 1.7 for about 6 years now with no issues. However, recently I updated the CodeIgniter framework to 2.1.1 and now the .htaccess is having issues. I've confirmed in the logs that it isn't getting to my controller so I believe this to be purely an .htaccess issue.
I've got several typical URL patterns:
Code:
mysite.com/<page name here>, i.e. mysite.com/faq
mysite.com/admin/<action here>, i.e. mysite.com/admin/login
My .htaccess is currently:
Code:
RewriteRule ^([a-zA-Z0-9]+)$ page/id/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Now, as should be apparent, mysite.com/faq should be rewritten to mysite.com/page/id/faq, but it is throwing a 404 instead.
Just going to mysite.com successfully loads the default controller, in this case the home page or the equivalent to mysite.com/home. All of the admin urls are working perfectly. mysite.com/page/id/<page name here> is also working perfectly.
Just for comparison, the original .htaccess that has worked fine for 6 years until I upgraded CodeIgniter was:
Code:
RewriteRule ^((images|styles|scripts|documents)/*.*)$ $1 [L]
RewriteRule ^(admin/*)$ index.php/$1 [L]
RewriteRule ^([a-zA-Z0-9]+)$ page/id/$1
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L]
This original one has the exact same behavior as the one I am currently trying to use above.
The actual upgrade process was JUST on the CodeIgniter framework and reorganizing the files into the separate application and system folders, none of my actual custom code was touched other than the minimal changes that were required as part of the upgrade process.
I've tried about a billion different .htaccess command combos trying to get this thing to work and just can't get both the "normal" pages and the admin pages to load correctly with the same config. Ultimately my question is why did upgrading CodeIgniter magically break the URL rewriting, but I'd be more than happy to simply have this working again.
Does anyone have suggestions? I'd love another set of eyes on this.