我有一个cakephp应用程序作为根文件夹,.htaccess
编写如下
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
现在我想要的是它的子文件夹中的核心php应用程序,但是.htaccess
给我带来了麻烦。
写.htaccess
的最佳方式是什么,这样两者都可以。
答案 0 :(得分:2)
最简单的解决方案是简单地在webroot目录中放置您想要访问的内容,例如,对于网址http://example.com/other/thing.php
,请不要这样做:
html/
app
webroot/
other/
thing.php
这样做:
html/
app
webroot/
other/
thing.php
答案 1 :(得分:-1)
我会使用RewriteMap Directive而不是直接尝试从PHP代码编辑.htaccess。 请检查此answer。