Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如果url中没有应用程序名称,如何运行cakephp网站?_Php_.htaccess_Cakephp_Routes - Fatal编程技术网

如果url中没有应用程序名称,如何运行cakephp网站?

如果url中没有应用程序名称,如何运行cakephp网站?,php,.htaccess,cakephp,routes,Php,.htaccess,Cakephp,Routes,我在cakephp2.1.3版本中有两个应用程序,一个是admin,第二个是web,我想在没有应用程序名称的情况下运行我的网站,就像没有“web”一样,当前的网站url是http://localhost/cakephp2.1.3/web/customers/index'但我需要使用'http://localhost/cakephp2.1.3/customers/index" 我当前的.htaccess是 <IfModule mod_rewrite.c> RewriteEngi

我在cakephp2.1.3版本中有两个应用程序,一个是admin,第二个是web,我想在没有应用程序名称的情况下运行我的网站,就像没有“web”一样,当前的网站url是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>
当我尝试访问'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

假设您不能添加一个新的域和一个新的VirtualHost,请查看可以将url映射到(不同)文件系统位置的apache

在您的情况下,您将需要以下内容:

Alias /cakephp2.1.3 /cakephp2.1.3/web/

这很好,但我也需要它,当我去我的特定领域生活。那么我如何在没有“web”的情况下运行我的网站呢?您可以用同样的方式配置apache(假设您也在使用apache)。
Alias /cakephp2.1.3 /cakephp2.1.3/web/