首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >mod_rewrite在OS X Lion上无法很好地使用cfimport (Coldfusion)

mod_rewrite在OS X Lion上无法很好地使用cfimport (Coldfusion)
EN

Stack Overflow用户
提问于 2011-11-16 00:51:02
回答 1查看 141关注 0票数 1

在OS X Lion和Coldfusion 9开发人员版上运行Apache。我有以下.htaccess文件。

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

发布于 2011-11-16 03:06:12

我不知道cfimport为什么/如何导致mod_rewrite触发-它甚至不应该与web服务器进行对话。

也许你需要在CF管理中创建一个/lib映射?

无论如何,您可以通过在开头添加一个否定的先行前缀来阻止重写规则摆弄它,告诉它忽略lib/tags,如下所示:

代码语言:javascript
复制
(?!lib/tags)

将其放在第二个表达式的^之后。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8139987

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档