gpt4 book ai didi

php - 如何使用 .htaccess 更改 URL 中的字母大小写?

转载 作者:搜寻专家 更新时间:2023-10-31 21:30:34 24 4
gpt4 key购买 nike

我在 Apache [服务器版本:Apache/2.4.6 (Ubuntu)] [服务器构建:2014 年 3 月 19 日 20:56:01] 中遇到 mod_rewrite 问题我正在处理用 PHP CodeIgniter 编写的带有这样一个 .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

结果我想改变http://example.com/my_dir/test/myActionhttp://example.com/my_dir/Test/myAction (我的 Controller 名称中的大写字母 T)]。它适用于 Windows 8。可能是因为 Windows 完全忽略字母大小写。但是如何让它在 Linux 上运行呢?我的 .htaccess 有什么问题?此外,将带有第一个 RewriteRule 的行向下移动,会导致“内部服务器错误”。

我的 error.log 显示如下内容:

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]

最佳答案

我认为您的“myAction”URL 组件加倍可能是与 [DPI] 标志相关的错误/问题。你在重写规则上试过吗?

默认情况下,PATH_INFO 会溢出并恢复。但是,如果您捕获并附加它,就像您所做的那样,您最终会重复。

关于php - 如何使用 .htaccess 更改 URL 中的字母大小写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30440548/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com