mod_rewrite - 更改 URL 大小写 [英] mod_rewrite - change URL case

查看:20
本文介绍了mod_rewrite - 更改 URL 大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何直接的方法可以使用 mod_rewrite 更改任何 URL 的大小写?

Is there any straightforward way to change the case of any URL using mod_rewrite?

我认为这很微不足道……显然不是.

I thought this was pretty trivial... apparently not.

示例:

http://example.com/idhttp://example.com/ID

http://example.com/id/123http://example.com/ID/123

等等.

推荐答案

mod_rewrite 有一些 内部函数 可用于映射.其中之一是将字母转换为大写的 toupper:

mod_rewrite has some internal functions you can use for a mapping. One of them is toupper that converts letters to uppercase:

RewriteMap uppercase int:toupper

RewriteRule [a-z] %{uppercase:%{REQUEST_URI}} [L,R=301]

这篇关于mod_rewrite - 更改 URL 大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆