仅使用非常特定的模式与 mod_rewrite 匹配 URL
我有一个小问题需要解决。我有两个并行运行的应用程序(CodeIgniter 和 ExpressionEngine),我需要将特定的 URL 模式路由到 CI,将其他所有内容路由到 EE。到目前为止,这基本上是有效的,但有一个小细节。这是我当前拥有的代码:
# Rewrite requests for anything that's not a CI controller or physical file/folder to ExpressionEngine
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !(admin|cron|fst_reporting|playcatch|ppv|purchase|reporting|xml) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]
# Route everything else to CodeIgniter
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /app/index.php/$1 [L]
但是,我还想将以下请求推送到
/training
/training/
/training/programme/something
/training/programme/something/
第一个条件块中的 EE,然后将针对一个特定 URL 模式的请求强制发送
/training/something
到 CI 应用程序(如第二个条件块中所示)。
我遇到的问题是尝试将上述要求融入到我现有的条件语句中,理想情况下我想说“任何不等于我的代码点火器控制器或等于/training或/training/programme/something的东西”。同时,我仍然需要能够将对 /training/something(其中某些内容是随机字符串)的请求路由到 CI 应用程序。
有什么想法吗? :)
I have a small problem to solve. I have two applications running side by side (CodeIgniter and ExpressionEngine) and I need to route specific URL patterns to CI and everything else to EE. So far this is mostly working but there's one small detail. Here's the code I currently have:
# Rewrite requests for anything that's not a CI controller or physical file/folder to ExpressionEngine
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !(admin|cron|fst_reporting|playcatch|ppv|purchase|reporting|xml) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]
# Route everything else to CodeIgniter
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /app/index.php/$1 [L]
However I also want to push any requests for:
/training
/training/
/training/programme/something
/training/programme/something/
to EE in the first conditional block and then force requests for one specific URL pattern
/training/something
to the CI application (as see in the 2nd conditional block).
The problem I have is trying to blend the above requirements into my existing conditional statement, ideally I want to say "Anything which is NOT equal to my code igniter controllers OR is equal to /training or /training/programme/something". Meanwhile I still need to be able to route requests for /training/something (where something is a random string of characters) to the CI app.
Any ideas? :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许是这样的:
希望有帮助。
Perhaps something like:
hope that helps.