如何让我的网址区分大小写在Linux服务器 [英] How do I make URLs case insensitive in Linux server

查看:222
本文介绍了如何让我的网址区分大小写在Linux服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作是部署在Linux服务器上的网站。我小的变化做到这一点。我的文件夹。要求是,如果我输入网址本地主机:80 /嗵/读 ../读 /读,它需要导航到 read.php 文件夹。

I am working a website which is deployed on a Linux server. I have small changes to do on that. I have folder read. The requirement is that if I enter the URL localhost:80/tom/Read or ../READ or /read it needs to navigate to read.php inside a read folder.

我创建了一个根目录下的文件的.htaccess。通过查看网页<置入遵循以下code提及的文件中href="https://forums.digitalpoint.com/threads/how-do-i-make-linux-server-urls-case-insensitive.1790511/"相对=nofollow>这里提到

I created a file .htaccess under a root directory. Placed following code mention below in the file by seeing the page mentioned here

RewriteEngine On
RewriteBase /tom/

RewriteMap  lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]

RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

RewriteRule ![A-Z] - [S=26]
RewriteRule ^(.*)(A)(.*)$ $1a$3 [N,R=301]
RewriteRule ^(.*)(B)(.*)$ $1b$3 [N,R=301]
RewriteRule ^(.*)(C)(.*)$ $1c$3 [N,R=301]
RewriteRule ^(.*)(D)(.*)$ $1d$3 [N,R=301]
RewriteRule ^(.*)(E)(.*)$ $1e$3 [N,R=301]
RewriteRule ^(.*)(F)(.*)$ $1f$3 [N,R=301]
RewriteRule ^(.*)(G)(.*)$ $1g$3 [N,R=301]
RewriteRule ^(.*)(H)(.*)$ $1h$3 [N,R=301]
RewriteRule ^(.*)(I)(.*)$ $1i$3 [N,R=301]
RewriteRule ^(.*)(J)(.*)$ $1j$3 [N,R=301]
RewriteRule ^(.*)(K)(.*)$ $1k$3 [N,R=301]
RewriteRule ^(.*)(L)(.*)$ $1l$3 [N,R=301]
RewriteRule ^(.*)(M)(.*)$ $1m$3 [N,R=301]
RewriteRule ^(.*)(N)(.*)$ $1n$3 [N,R=301]
RewriteRule ^(.*)(O)(.*)$ $1o$3 [N,R=301]
RewriteRule ^(.*)(P)(.*)$ $1p$3 [N,R=301]
RewriteRule ^(.*)(Q)(.*)$ $1q$3 [N,R=301]
RewriteRule ^(.*)(R)(.*)$ $1r$3 [N,R=301]
RewriteRule ^(.*)(S)(.*)$ $1s$3 [N,R=301]
RewriteRule ^(.*)(T)(.*)$ $1t$3 [N,R=301]
RewriteRule ^(.*)(U)(.*)$ $1u$3 [N,R=301]
RewriteRule ^(.*)(V)(.*)$ $1v$3 [N,R=301]
RewriteRule ^(.*)(W)(.*)$ $1w$3 [N,R=301]
RewriteRule ^(.*)(X)(.*)$ $1x$3 [N,R=301]
RewriteRule ^(.*)(Y)(.*)$ $1y$3 [N,R=301]
RewriteRule ^(.*)(Z)(.*)$ $1z$3 [N,R=301]

但它不能正常工作。

But it is not working.

我是新来的Linux环境。我不知道mod_speling。那是一个文件?凡将设在Linux服务器?

I am new to Linux environment. I don't know about mod_speling. Is that a file? Where it will be located in Linux server?

推荐答案

您可以轻松地使Apache网络服务器忽略的情况下通过的 mod_speling 模块,这是标准的Apache发行:

You can easily make the apache webserver ignore the case by using the mod_speling module, which is part of the standard apache distribution:

CheckSpelling On
CheckCaseOnly On

重启httpd,您可以访问后

这篇关于如何让我的网址区分大小写在Linux服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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