在OS X Lion和Coldfusion 9开发人员版上运行Apache。我有以下.htaccess文件。
Options +FollowSymlinks
Options +Indexes
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !=/index.cfm [NC]
RewriteRule ^([^/]+)/?$ /index.cfm?page=$1 [L,NC]
RewriteRule ^([^/]+)/([^/]+)/?$ /index.cfm?app=$1&page=$2 [L,NC]
Which is designed to handle URLs like mydomain.com/something and mydomain.com/something/else. Pretty normal stuff.
Everything seems to work fine until I load a file with a cfimport tag in it that looks like this:
<cfimport prefix="myLib" taglib="/lib/tags">
The RewriteLog shows that this gets picked up and processed and redirected which of course breaks everything.
I've tried adding several conditions like:
RewriteCond %{REQUEST_URI} !=lib/tags/ [NC]
RewriteCond %{REQUEST_URI} !=lib/tags [NC]
RewriteCond %{REQUEST_URI} !=/lib/tags/ [NC]
RewriteCond %{REQUEST_URI} !=/lib/tags [NC]
None of them prevent the problem.
If I restructure the directories so that I load it like this:
<cfimport prefix="myLib" taglib="/lib/dir/tags">
Everything is fine. This is not an option because this is a group development project and I'm the only one with problems and Windows/IIS is the target deployment environment.
The basic .htaccess file shown at the top appears to work on a co-workers Windows machine running Apache.发布于 2011-11-16 03:06:12
我不知道cfimport为什么/如何导致mod_rewrite触发-它甚至不应该与web服务器进行对话。
也许你需要在CF管理中创建一个/lib映射?
无论如何,您可以通过在开头添加一个否定的先行前缀来阻止重写规则摆弄它,告诉它忽略lib/tags,如下所示:
(?!lib/tags)将其放在第二个表达式的^之后。
https://stackoverflow.com/questions/8139987
复制相似问题