我有一个问题,添加一个默认的重写PHP和HTML请求到我的apache .htaccess。我的.htaccess中的递归循环
这个想法是为我的网站上的内容设置模板,指定文件夹中的内容使用特定的模板。它适用于html,图像和其他资源;很好地将请求重写到模板。但是,我得到一个递归的问题重写请求到php资源,因为模板也是一个php资源...也许在逻辑上足够。
是否有可能将php-to-php限制为单个重写?或者我需要另一种方法?
这条规则是我的问题:
RewriteRule ^(.*).(php$) /_templates/default.php?$1.$2 [NC,L]
下面是我的.htaccess ...
谢谢...
# Template rewrites:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(subpages/.*) /_templates/present.php?$1 [NC,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*).html$ /_templates/default.php?$1 [NC,L]
RewriteRule ^(.*).(php$) /_templates/default.php?$1.$2 [NC,L]
谢谢Artefacto, RewriteCond $ 1!^ _ templates/may the trick ...干杯 – 2010-07-05 19:44:56