Smarty 无法使用 .htaccess 和 mod_rewrite 写入 template_c

Smarty unable to write to template_c with .htaccess and mod_rewrite

我正在使用这段代码

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^.?]+)$ /content%{REQUEST_URI}.php [L]
</IfModule>

使我的网址看起来 "prettier" 所以不是域。com/content/file。php 它只是域。com/file

调用我的 smarty 模板的 PHP 文件在内容目录中。我已将 template_c 上的权限递归更改为 777,但我仍然收到错误消息 "Smarty: unable to write file /.../templates_c"。当我将 php 文件移出内容目录并在域中访问它时。com/file.php,Smarty 完美运行。如何将我的 php 文件保存在内容目录中并保留 mod_rewrite 并且仍然能够使用 Smarty?

我只需要在我的内容文件夹中创建 templates_c 和具有适当权限的缓存文件夹。我试过了,它有效!感谢 Borgtex 让我走上正轨。