这是本站遭遇的一个技术问题。当访问"c#"的标签时候,程序的解析地址应为:
http://www.cnprog.com/tags/c%23/
在正常情况下,包括我们的多个工作环境,这个地址是能被正确解析的。但是在bluehost的服务器上,却被转发到地址:
http://www.cnprog.com/t/tags/c/
目前怀疑是bluehost的apache配置了对“#”的地址重写规则,后又针对#在后面多加字符作了测试,结果如下:
http://domain/tags/c%23 http://domain//tags/c/
http://domain/tags/c%23/ http://domain/t/tags/c/
http://domain/tags/c%23h http://domain/t/tags/c/
http://domain/tags/c%23he http://domain/ta/tags/c/
http://domain/tags/c%23hel http://domain/tag/tags/c/
http://domain/tags/c%23hell http://domain/tags/tags/c/
http://domain/tags/c%23hello http://domain/tags//tags/c/
http://domain/tags/c%23hellow http://domain/
http://domain/tags/c%23hellowo http://domain/tags/c%23/////////////////////tags/c/
只对%23做了过滤,其他如%20没有问题。这是现有的.htaccess设置:
AddHandler fcgid-script .fcgi
#AddHandler fastcgi-script .fcgi
#AddHandler application/cgi .fcgi
#AddHandler cgi-script .fcgi
RewriteEngine On
RewriteBase /
#static file setting
RewriteRule ^(media/.*)$ - [L]
RewriteRule ^(static/.*)$ - [L]
RewriteCond %{REQUEST_URI} !(dispatch.fcgi)
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]
如果推测和分析正确的话,现在的问题是如何在.htaccess覆盖apache地址重写规则?