I have problem with mod_rewrite in Apache [Server version: Apache/2.4.6 (Ubuntu)] [Server built: Mar 19 2014 20:56:01] I am working with project written in PHP CodeIgniter with such a .htaccess:
RewriteEngine on
RewriteBase /my_dir/
RewriteRule (.*)test/myAction(.*) $1Test/myAction$2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
AddType video/mov .mov
As a result I want changing http://example.com/my_dir/test/myAction to http://example.com/my_dir/Test/myAction (uppercase letter T in my controller name)]. It works on Windows 8. Probably because Windows ignores letter case at all. But how to make it working on Linux? What is wrong with my .htaccess? Additionally moving the line with first RewriteRule lower, results in "Internal server error".
My error.log shows something like this:
rewrite 'test/myAction' -> 'Test/myAction'
rewrite 'Test/myAction/myAction' -> 'index.php/Test/myAction/myAction'
forcing '/var/www/my_dir/index.php/Test/myAction/myAction' to get passed through to next API
trying to replace prefix /var/www/my_dir/ with /my_dir/
internal redirect with /my_dir/index.php/Test/myAction/myAction [INTERNAL REDIRECT]
pass through /var/www/my_dir/index.php
rewrite 'Test/myAction/myAction' -> 'index.php/Test/myAction/myAction'
forcing '/var/www/index.php/Test/myAction/myAction' to get passed through to next API URI-to-filename handler
strip document_root prefix: /var/www/index.php/Test/myAction/myAction -> /index.php/Test/myAction/myAction
internal redirect with /index.php/Test/myAction/myAction [INTERNAL REDIRECT]
I think the doubling of your "myAction" URL component might be a bug/issue related to the [DPI] flag. Have you tried it on the rewriterules?
By default, PATH_INFO is spilled and restored. But if you capture and append it, as you do, you end up with a repeat.