[英]how can i run cakephp website without app name in url?
I have two app in cakephp2.1.3 vesion, one is admin and second is web, I want to run my website without my app name like without 'web', current website url is 'http://localhost/cakephp2.1.3/web/customers/index' but i need to access using 'http://localhost/cakephp2.1.3/customers/index'. 我在cakephp2.1.3 vesion中有两个应用程序,一个是admin,第二个是web,我想在没有我的应用程序名称的情况下运行我的网站,就像没有“ web”一样,当前网站的URL是“ http://localhost/cakephp2.1.3/web / customers / index”,但我需要使用“ http://localhost/cakephp2.1.3/customers/index”进行访问。
My current .htaccess is 我当前的.htaccess是
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^admin/$ admin/webroot/ [L]
RewriteRule ^$ web/webroot/ [L]
RewriteRule (.*) web/webroot/$1 [L]
</IfModule>
and i have just change outer index.php 而且我只是更改了外部index.php
define('APP_DIR', 'web');
When i try to access 'http://localhost/cakephp2.1.3/customers/index' it gives error 当我尝试访问'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
Assuming you cannot add a new domain and a new VirtualHost, look into apache's mod_alias that can map a url to a (different) filesystem location. 假设您无法添加新域和新VirtualHost,请查看可将URL映射到(不同)文件系统位置的apache的mod_alias 。
In your case you'll need something like this: 在您的情况下,您将需要以下内容:
Alias /cakephp2.1.3 /cakephp2.1.3/web/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.