【发布时间】:2011-04-13 08:40:42
【问题描述】:
如何配置 CodeIgniter 应用程序,以便我可以拥有一个只提供一些静态(非 MVC)html 的目录?
我想处理一些现有的链接,形式为:
http://mysite/contactform/contact.html?queryvars
/contactform 目录中的任何内容,包括子目录(只是一些 css、js、图像等)都不应通过 CodeIgniter 管道。处理它的最佳方法是什么? (我平时是 Windows 开发者,所以说慢点)
我认为它必须在重写配置中完成?
routes.php 非常基础:
$route['default_controller'] = "home";
从 .htaccess 重写规则:
# you probably want www.example.com to forward to example.com -- shorter URLs are sexier.
# no-www.org/faq.php?q=class_b
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteEngine on
RewriteCond $1 !^(index\.php|contact\.php|images|css|js|video|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
【问题讨论】:
标签: php apache mod-rewrite codeigniter