2017-10-11 47 views
0

以下是我.htaccess文件的内容:如何使这个URL不区分大小写

<IfModule mod_speling.c> 
CheckSpelling On 
CheckCaseOnly On 
</IfModule> 
# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /blog/ 
RewriteRule ^index\.php$ - [L,NC] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /blog/index.php [L,NC] 
</IfModule> 

# END WordPress 

注:博客上服务器目录中存在

我喜欢写一个重写规则或任何其他的东西,它可以改变或重写这www.example.com/BLOG/anything-here/foo/barwww.example.com/blog/anything-here/foo/bar

换句话说,就是所有我要的是这个词BLOG的情况下变成小写博客

我试图用CheckCaseOnly On但其没有工作,但其工作对其他词语的URL,但它不工作此特定博客字,这是rewritebase

回答

0

你可以尝试这样的事情 -

RewriteEngine叙述在
RewriteMap指令小写INT:tolower的
RewriteCond%{REQUEST_URI} [A-Z] ##因此,只有在URI中有大写字母的情况下才应用此规则。
RewriteRule^/(。*)$/$ {lowercase:$ 1}

这应该有效。

注 - '小写'只是一个变量名称,可以是任何东西。

+0

谢谢,但是,RewriteMap不适用于bluehost共享服务器托管计划 –