![](/img/trans.png)
[英]CakePHP: How can I select all elements of one category with a “nice” url? (/category/NAME_OF_CATEGORY)
[英]how can i run cakephp website without app name in url?
我在cakephp2.1.3 vesion中有两个应用程序,一个是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>
而且我只是更改了外部index.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
假设您无法添加新域和新VirtualHost,请查看可将URL映射到(不同)文件系统位置的apache的mod_alias 。
在您的情况下,您将需要以下内容:
Alias /cakephp2.1.3 /cakephp2.1.3/web/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.