我在cakephp2.1.3 vesion中有两个应用程序,一个是管理员,第二个是网络,我想在没有应用程序名称的情况下运行我的网站,就像没有"web"一样,当前网站网址是"http://localhost/cakephp2.1.3/web/customers/index",但我需要使用"http://localhost/cakephp2.1.3/customers/index"访问。
我目前的 .htaccess 是
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^admin/$ admin/webroot/ [L]
RewriteRule ^$ web/webroot/ [L]
RewriteRule (.*) web/webroot/$1 [L]
</IfModule>
我刚刚更改了外部索引.php
define('APP_DIR', 'web');
当我尝试访问"http://localhost/cakephp2.1.3/customers/index"时,它给出错误
Error: Cakephp-2.1.3Controller could not be found.
Error: Create the class Cakephp-2.1.3Controller below in file: web'Controller'Cakephp-2.1.3Controller.php
假设您无法添加新域和新的虚拟主机,请查看 apache 可以将 url 映射到(不同)文件系统位置的mod_alias。
在您的情况下,您将需要这样的东西:
Alias /cakephp2.1.3 /cakephp2.1.3/web/