将网址重写为小写的最快方法?
我正在寻找一种方法,最好使用 .htaccess 在用户输入大写字母时重写 url。
例如,URL 可以是 website.com/pagename
,用户类型可以是 website.com/PageName 或 website.com/PAGENAME
在不减慢页面加载速度的情况下,最好的方法是什么?
I'm looking for a way, preferably with .htaccess to rewrite a url when a user types in something with a capital.
For example, the url could be website.com/pagename
and the usertypes in website.com/PageName or website.com/PAGENAME
Whats the best way to do with without slowing down page load?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以执行 HTTP 重定向(通过 Apache):
或者在 PHP 中进行处理:
HTTP 重定向实际上不如 PHP 解决方案那么有效。
You can either do an HTTP redirect (via Apache):
or do the processing in PHP:
HTTP redirection isn't really as efficient as the PHP solution.