任何人都知道在vhost.conf中放入什么来让apache复制它(来自.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)?
答案 0 :(得分:3)
在使用/
预先添加模式时,它应该有效:
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文件的缺点很简单,它们实际上需要在每次请求时进行解释,而虚拟主机配置在服务器启动时只被解释一次。
答案 1 :(得分:1)