简体   繁体   中英

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'.

My current .htaccess is

<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

define('APP_DIR', 'web');

When i try to access 'http://localhost/cakephp2.1.3/customers/index' it gives error

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.

In your case you'll need something like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM