转换链接直接使用htaccess的,除了查询字符串小写 [英] Convert url to lower case using htaccess except query string

查看:232
本文介绍了转换链接直接使用htaccess的,除了查询字符串小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很努力了htaccess的问题。

Am struggling with a htaccess problem.

我需要转换大写所有URL为小写。但查询字符串单独应该是相同的。

I need to convert all the URLs from uppercase to lowercase. But the query string alone should be the same.

例如,

www.tESTUrl.com/sOMePath/?q=SomeStringHere

应转换为,

www.testurl.com/somepath/?q=SomeStringHere

请帮忙解决这个问题。先谢谢了。

Please help to fix this. Thanks in advance.

推荐答案

首先,你必须将它添加到你的httpd.conf:

First You have to add this to your httpd.conf:

RewriteMap lc int:tolower

然后粘贴低于code到的.htaccess

RewriteEngine On
RewriteBase / 
RewriteCond %{REQUEST_URI} ^[^A-Z]*[A-Z].*
RewriteRule ^ ${lc:%{REQUEST_URI}} [L,R=301]

这code redirct网址像是

This code redirct the url like from

www.tESTUrl.com/sOMePath/?q=SomeStringHere

www.testurl.com/somepath/?q=SomeStringHere

这篇关于转换链接直接使用htaccess的,除了查询字符串小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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