任何人都知道在apache的vhost.conf中放什么来复制(来自.htaccess):
RewriteEngine on
RewriteCond $1 !^(index\.php|images|scripts|css|uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L] 基本上,我希望除/images、/scripts或/css之外的所有请求都通过/index.php。
当我使用.htaccess文件时,它可以工作,但我也想知道如何通过vhost.conf来实现它。有没有人知道在性能、稳定性等方面,使用一种比另一种更好(vhost.conf vs htaccess)?
发布于 2010-12-06 05:55:58
当使用/作为模式的前缀时,它应该可以工作:
RewriteCond $1 !^(index\.php|images|scripts|css|uploads|robots\.txt)
RewriteRule ^/(.*)$ /index.php/$1 [L]或者:
RewriteCond $1 !^/(index\.php|images|scripts|css|uploads|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L].htaccess文件的缺点很简单,即它们实际上需要在每次请求时进行解释,而虚拟主机配置在服务器启动时只需要解释一次。
发布于 2010-12-06 09:35:32
Gumbo++
我在httpd wiki上写了这篇文章来讨论像这样的问题。
http://wiki.apache.org/httpd/RewriteContext
https://stackoverflow.com/questions/4361439
复制相似问题