我形我页两种不同的RewriteRules:重写规则会导致页面重新加载两次
# Enable URL Rewriting
RewriteEngine on
# exclude followed stuff
RewriteRule ^(js|img|css|favicon\.ico|image\.php|anprobe|content|libs|flash\.php|securimage)/ - [L,QSA,S=2]
# conditions (REQUEST dont point @ file|dir|link)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-F
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
# rules
RewriteRule ^(?!index\.php)brillen/(.*(brillen)|360|neu)/(.*)([a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}(?!\.))(.*)$ /index.php/brillen/$1?art_id=$4&$5&%{QUERY_STRING} [NS,QSA,L]
RewriteRule ^(?!index\.php)(.*)$ /index.php/$1 [NS,QSA,L]
...我现在遇到一个奇怪的问题,就在于每个请求导致页面内加载了两次,这导致数据库操作和电子邮件分派也被执行两次的问题。
有没有人有关于此的想法?
在此先感谢!
注1:根据浏览器的资源跟踪,所有请求的资源都是有效的和可用的。
注2:问题可能起源于保留和后处理PATH_INFO? (/index.php/$1=> /index.php/foo/bar/...)
是什么让你觉得每个页面加载两次? – qbert220 2011-05-10 10:36:18
正如我所提到的:数据库操作和电子邮件分派执行两次...我通过发射一些syslog来验证我的假设,它也出现两次。 – proximus 2011-05-10 10:43:03
错误的来源是一些PHP代码被调用两次......对我感到羞耻! :( – proximus 2011-05-10 11:20:08