简体   繁体   English

如何在没有URL的应用程序名称的情况下运行cakephp网站?

[英]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.

相关问题 CakePHP:如何使用“漂亮”网址选择一个类别的所有元素? (/类别/ NAME_OF_CATEGORY) - CakePHP: How can I select all elements of one category with a “nice” url? (/category/NAME_OF_CATEGORY) 如何使用CakePHP APP类从URL加载XML文件? - How can I use the CakePHP APP class to load XML files from a URL? 我需要 laravel 网站在 https 中打开而不在 url 中公开,我该怎么做? - I need laravel website to open in https without public in url, how can I do it? 我如何在 CWP (Centos-Web-Panel) 中使用 laravel 网站。 网址中没有公共文件夹? - how can i use laravel website in CWP (Centos-Web-Panel). without public folder in url? cakephp,如何将类添加到url而不是图像 - cakephp, how can I add a class to the url instead of the image 如何在 CakePHP 中将 staff_name 列保存为其他列? - How can I save staff_name column as others in CakePHP? cakephp,如何更改控制器的URL名称 - cakephp, How to change controller url name 如何在不破坏CakePHP的MVC框架的情况下做到这一点? - How can I do this without breaking the MVC framework in CakePHP? 如何在不写任何URL的情况下将数据发送到网站? - How do I send data to a website without writing anything in the URL? 如何从cakephp中的URL删除应用程序子文件夹 - How to remove app subfloder from url in cakephp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM