【发布时间】:2014-10-31 20:52:39
【问题描述】:
我有 URL 重写规则:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/sites/
RewriteRule ^([^/]+)/?(.*)$ sites/$1/$2 [NC,L]
调用此 URL 时:http://example.com/suyash
它在内部调用http://example.com/sites/suyash,但仅将URL 保留为http://example.com/suyash。请注意文件夹sites/suyash确实存在
我面临的问题是,当我调用 URL:http://example.com/Suyash(大写)时,它会显示 404 错误。
当我使用 mod_speling 模块并将以下内容添加到代码中时:
CheckSpelling On
现在当我调用 http://example.com/Suyash 时,它会将 URL 更改为 http://example.com/sites/suyash
如何让它只将 URL 从 http://example.com/Suyash 更改为 http://example.com/suyash?
【问题讨论】:
-
一旦我添加 CheckSpelling 并以错误的大小写点击 url,就会发生这种情况
-
有可能因为文件夹sites/suyash存在而不是sites/Suyash,代码上的CheckSpelling会重定向url\
-
但代码:RewriteRule ^([^/]+)/?(.*)$ sites/$1/$2 [NC,L] 只会正常重写url
-
好的,当你关闭
CheckSpelling时会有什么行为@ -
当 CheckSpelling 关闭时错误大小写显示 404 错误
标签: .htaccess mod-rewrite mod-speling