How can I change the case of letters in a URL using .htaccess?

I have a problem with mod_rewrite in Apache [Server version: Apache / 2.4.6 (Ubuntu)] [Server built: March 19, 2014 20:56:01] I am working on a project written in PHP CodeIgniter with this .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 to change http://example.com/my_dir/test/myAction to http://example.com/my_dir/test/myAction (capital T in my controller name)]. It works on Windows 8. Possibly because Windows ignores case at all. But how do you make it work on Linux? What's wrong with my .htaccess? Also, moving the line with the first RewriteRule below results in an "Internal Server Error" 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]

      

+3


source to share


1 answer


I think doubling your "myAction" url might be a bug / problem with the [DPI] flag. Have you tried it on rewriters?



By default, PATH_INFO is spilled and recovered. But if you write it down and add it like you do, you get repetition.

+1


source







All Articles