【发布时间】:2014-04-14 20:38:18
【问题描述】:
我在后端有一个带有自定义引擎的项目,我正在尝试使用我的 CodeIgniter 挂钩 /somewhere/ 的每个请求。所以我把我的 CI 放到/www/somewhere/,用新的 RewriteBase 配置了我的 CodeIgniter 的 .htaccess,所以它现在看起来像:
AddDefaultCharset UTF-8
Options All -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /somewhere/
DirectoryIndex index.html index.php
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
我的 CI 为这个项目创建静态 html 并将其存储在 /compiled/,所以我有这个结构
/www/
/custom-engine/
/img/
/js/
/somewhere/ <--- My CI's root
/application/
/system/
/compiled/ <--- My storage for HTML
my-file.html
/my-compiled-folder/
/one-more/
/sub-compiled/
index.html
一切正常。但。但是我需要在 URL 中打开没有/compiled/ 的编译文件。
作品:http://domain.com/somewhere/compiled/one-more/sub-compiled/
需要:http://domain.com/somewhere/one-more/sub-compiled/
我不需要重定向到我编译的文件夹/文件,只需打开它。所以我需要在我的 .htaccess 中添加一些东西。我还想继续访问我的 CI。例如,我有控制器helloworld,现在可以从http://domain.com/somewhere/helloworld/ 访问它(实际上我在这里有somewhere 的管理面板)。
所以.. 我想直接从我的/compiled/ 打开文件,但我还需要保存我的 CI。我应该在我的 .htaccess 中添加什么?
【问题讨论】:
标签: .htaccess mod-rewrite codeigniter-2 subdirectory